瀏覽代碼

fix auto-animate bug on devices with < 2 devicePixelRatio

Hakim El Hattab 5 年之前
父節點
當前提交
b84888214b
共有 1 個文件被更改,包括 10 次插入1 次删除
  1. 10 1
      js/controllers/autoanimate.js

+ 10 - 1
js/controllers/autoanimate.js

@@ -343,7 +343,16 @@ export default class AutoAnimate {
 				bounds = elementOptions.measure( element );
 				bounds = elementOptions.measure( element );
 			}
 			}
 			else {
 			else {
-				bounds = element.getBoundingClientRect();
+				bounds = {
+					x: element.offsetLeft * scale,
+					y: element.offsetTop * scale,
+					width: element.offsetWidth * scale,
+					height: element.offsetHeight * scale
+				};
+
+				// More precise, but breaks when used in combination
+				// with zoom for scaling the deck ¯\_(ツ)_/¯
+				// bounds = element.getBoundingClientRect();
 			}
 			}
 
 
 			properties.x = bounds.x;
 			properties.x = bounds.x;