Another scale method (original for engine)
This commit is contained in:
parent
a673524ec3
commit
99631a6d08
2 changed files with 20 additions and 24 deletions
|
@ -148,18 +148,16 @@ document.addEventListener("backbutton", function(event){
|
|||
// =====================
|
||||
|
||||
document.addEventListener("deviceready", () => {
|
||||
Graphics._centerElement = function (element) {
|
||||
console.log("Element centered!!!");
|
||||
var width = 640 * (window.screen.height / 480);
|
||||
var height = window.screen.height;
|
||||
element.style.position = 'absolute';
|
||||
element.style.margin = 'auto';
|
||||
element.style.top = 0;
|
||||
element.style.left = 0;
|
||||
element.style.right = 0;
|
||||
element.style.bottom = 0;
|
||||
element.style.width = width + 'px';
|
||||
element.style.height = height + 'px';
|
||||
Graphics._updateRealScale = function () {
|
||||
if (this._stretchEnabled) {
|
||||
var h = window.innerWidth / this._width;
|
||||
var v = window.innerHeight / this._height;
|
||||
if (h >= 1 && h - 0.01 <= 1) h = 1;
|
||||
if (v >= 1 && v - 0.01 <= 1) v = 1;
|
||||
this._realScale = Math.min(h, v);
|
||||
} else {
|
||||
this._realScale = this._scale;
|
||||
}
|
||||
};
|
||||
})
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue