提交 bf3f7508 编写于 作者: P pikilipita 提交者: GitHub

fixing portrait mode

keep the canvas the same aspect ratio as the video even on portrait
上级 3e61c92b
......@@ -346,12 +346,33 @@ ARjs.Source.prototype.onResizeElement = function(mirrorDomElements){
_this.copyElementSizeTo(domElement)
})
}
/*
ARjs.Source.prototype.copyElementSizeTo = function(otherElement){
otherElement.style.width = this.domElement.style.width
otherElement.style.height = this.domElement.style.height
otherElement.style.marginLeft = this.domElement.style.marginLeft
otherElement.style.marginTop = this.domElement.style.marginTop
}
*/
ARjs.Source.prototype.copyElementSizeTo = function(otherElement){
if (window.innerWidth > window.innerHeight)
{
//landscape
otherElement.style.width = this.domElement.style.width
otherElement.style.height = this.domElement.style.height
otherElement.style.marginLeft = this.domElement.style.marginLeft
otherElement.style.marginTop = this.domElement.style.marginTop
}
else {
//portrait
otherElement.style.height = this.domElement.style.height
otherElement.style.width = (parseInt(otherElement.style.height) * 4/3)+"px";
otherElement.style.marginLeft = ((window.innerWidth- parseInt(otherElement.style.width))/2)+"px";
otherElement.style.marginTop = 0;
}
}
//////////////////////////////////////////////////////////////////////////////
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册