Corrected fullscreen mode with canvas for border
This commit is contained in:
parent
f88a959b67
commit
33c136a1bc
|
@ -166,6 +166,7 @@ function init() {
|
||||||
// object.rotation.y = Math.PI - theta;
|
// object.rotation.y = Math.PI - theta;
|
||||||
|
|
||||||
// object.up = new THREE.Vector3(0,0,1);
|
// object.up = new THREE.Vector3(0,0,1);
|
||||||
|
// collidableObjects.push(object);
|
||||||
// scene.add(object);
|
// scene.add(object);
|
||||||
// object.traverse(function (object) {
|
// object.traverse(function (object) {
|
||||||
// if (object instanceof THREE.Mesh) {
|
// if (object instanceof THREE.Mesh) {
|
||||||
|
@ -238,15 +239,15 @@ function fullscreen() {
|
||||||
container.style.height="";
|
container.style.height="";
|
||||||
container.style.overflow = "hidden";
|
container.style.overflow = "hidden";
|
||||||
|
|
||||||
// canvas.style.position = "absolute";
|
canvas.style.position = "absolute";
|
||||||
// canvas.style.cssFloat = "top-left";
|
canvas.style.cssFloat = "top-left";
|
||||||
// canvas.style.top = "0px";
|
canvas.style.top = "0px";
|
||||||
// canvas.style.bottom = "0px";
|
canvas.style.bottom = "0px";
|
||||||
// canvas.style.left = "0px";
|
canvas.style.left = "0px";
|
||||||
// canvas.style.right = "0px";
|
canvas.style.right = "0px";
|
||||||
// canvas.width=window.innerWidth;
|
canvas.width=window.innerWidth;
|
||||||
// canvas.height=window.innerHeight;
|
canvas.height=window.innerHeight;
|
||||||
// canvas.style.overflow = "hidden";
|
canvas.style.overflow = "hidden";
|
||||||
|
|
||||||
onWindowResize();
|
onWindowResize();
|
||||||
}
|
}
|
||||||
|
@ -260,8 +261,12 @@ function stopFullscreen() {
|
||||||
|
|
||||||
// canvas.style.position = "";
|
// canvas.style.position = "";
|
||||||
// canvas.style.cssFloat = "";
|
// canvas.style.cssFloat = "";
|
||||||
// canvas.style.width = container_size.width + "px";
|
canvas.style.top = "";
|
||||||
// canvas.style.height = container_size.height + "px";
|
canvas.style.bottom = "";
|
||||||
|
canvas.style.left = "";
|
||||||
|
canvas.style.right = "";
|
||||||
|
canvas.width = container_size.width;
|
||||||
|
canvas.height = container_size.height;
|
||||||
// canvas.style.overflow = "";
|
// canvas.style.overflow = "";
|
||||||
|
|
||||||
onWindowResize();
|
onWindowResize();
|
||||||
|
@ -315,15 +320,13 @@ function render() {
|
||||||
renderer.render(scene, cameras.mainCamera());
|
renderer.render(scene, cameras.mainCamera());
|
||||||
|
|
||||||
// Clear canvas
|
// Clear canvas
|
||||||
// canvas.width = canvas.width;
|
canvas.width = canvas.width;
|
||||||
|
|
||||||
width = container.offsetWidth / 5;
|
width = container.offsetWidth / 5;
|
||||||
height = container.offsetHeight / 5;
|
height = container.offsetHeight / 5;
|
||||||
left = prev.x - width/2;
|
left = prev.x - width/2;
|
||||||
bottom = renderer.domElement.height - prev.y + height/5;
|
bottom = renderer.domElement.height - prev.y + height/5;
|
||||||
|
|
||||||
// ctx2d.clearRect(left-1,bottom+1,width+1,height+1);
|
|
||||||
|
|
||||||
if (prev.go) {
|
if (prev.go) {
|
||||||
// Hide arrows
|
// Hide arrows
|
||||||
cameras.map(function(camera) { if (camera instanceof FixedCamera) hide(camera); });
|
cameras.map(function(camera) { if (camera instanceof FixedCamera) hide(camera); });
|
||||||
|
@ -335,24 +338,24 @@ function render() {
|
||||||
|
|
||||||
|
|
||||||
// Draw border
|
// Draw border
|
||||||
// var can_bottom = container.offsetHeight - bottom - height ;
|
var can_bottom = container.offsetHeight - bottom - height ;
|
||||||
// ctx2d.strokeStyle = "#ffffff";
|
ctx2d.strokeStyle = "#ffffff";
|
||||||
// ctx2d.beginPath();
|
ctx2d.beginPath();
|
||||||
// ctx2d.moveTo(left-1, can_bottom);
|
ctx2d.moveTo(left-1, can_bottom);
|
||||||
// ctx2d.lineTo(left-1, can_bottom + height);
|
ctx2d.lineTo(left-1, can_bottom + height);
|
||||||
// ctx2d.lineTo(left + width-1, can_bottom + height);
|
ctx2d.lineTo(left + width-1, can_bottom + height);
|
||||||
// ctx2d.lineTo(left + width-1, can_bottom);
|
ctx2d.lineTo(left + width-1, can_bottom);
|
||||||
// ctx2d.closePath();
|
ctx2d.closePath();
|
||||||
// ctx2d.stroke();
|
ctx2d.stroke();
|
||||||
|
|
||||||
// ctx2d.strokeStyle = "#000000";
|
ctx2d.strokeStyle = "#000000";
|
||||||
// ctx2d.beginPath();
|
ctx2d.beginPath();
|
||||||
// ctx2d.moveTo(left, can_bottom + 1);
|
ctx2d.moveTo(left, can_bottom + 1);
|
||||||
// ctx2d.lineTo(left, can_bottom + height - 1);
|
ctx2d.lineTo(left, can_bottom + height - 1);
|
||||||
// ctx2d.lineTo(left + width - 2 , can_bottom + height-1);
|
ctx2d.lineTo(left + width - 2 , can_bottom + height-1);
|
||||||
// ctx2d.lineTo(left + width - 2, can_bottom+1);
|
ctx2d.lineTo(left + width - 2, can_bottom+1);
|
||||||
// ctx2d.closePath();
|
ctx2d.closePath();
|
||||||
// ctx2d.stroke();
|
ctx2d.stroke();
|
||||||
|
|
||||||
// Do render in previsualization
|
// Do render in previsualization
|
||||||
prev.camera.look();
|
prev.camera.look();
|
||||||
|
|
Loading…
Reference in New Issue