Skip to content

Commit 3c30bd7

Browse files
author
zhangxinxu
committed
scale calculate by content size
scale calculate by content size
1 parent dbea183 commit 3c30bd7

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

plugins/ppt/mobilebone.ppt.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,11 +112,18 @@ if (window.Mobilebone && Mobilebone.support) {
112112
}
113113
};
114114

115+
var eleContent = document.querySelector(".content");
115116
// 确定缩放比例
116117
var funGetScale = function() {
117118
var width = window.innerWidth, height = window.innerHeight;
118-
var scaleWidth = width / 1024,
119-
scaleHeight = height / 768;
119+
var sizeX = 1024; sizeY = 768, styleContent = {};
120+
if (eleContent) {
121+
styleContent = window.getComputedStyle(eleContent);
122+
sizeX = parseInt(styleContent.width);
123+
sizeY = parseInt(styleContent.height);
124+
}
125+
var scaleWidth = width / sizeX,
126+
scaleHeight = height / sizeY;
120127
return Math.min(scaleWidth, scaleHeight).toFixed(2);
121128
};
122129

0 commit comments

Comments
 (0)