From adf83e71de39e581edf63e58ec19e30f2b4fa479 Mon Sep 17 00:00:00 2001 From: Jeremy Ruston Date: Thu, 7 Jun 2012 13:29:16 +0100 Subject: [PATCH] Changes the chooser and the zoomer to use the browser prefix mechanism --- core/modules/macros/chooser.js | 6 ++---- core/modules/macros/zoomer.js | 8 ++++---- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/core/modules/macros/chooser.js b/core/modules/macros/chooser.js index 35c2c889d..8a217d788 100644 --- a/core/modules/macros/chooser.js +++ b/core/modules/macros/chooser.js @@ -89,10 +89,8 @@ exports.hoverChooser = function(x,y) { var scale = scaleFactor * expandFactor, translateX = x > 16 ? 0 : -(((16-x)/16) * widthPanel) / scale, translateY = (y / scale) - ((y/window.innerHeight) * heightPanel); - domPanel.style.webkitTransformOrigin = - domPanel.style.MozTransformOrigin = "0 0"; - domPanel.style.webkitTransform = - domPanel.style.MozTransform = "scale(" + scale + ") translateX(" + translateX + "px) translateY(" + translateY + "px)"; + domPanel.style[$tw.browser.transformorigin] = "0 0"; + domPanel.style[$tw.browser.transform] = "scale(" + scale + ") translateX(" + translateX + "px) translateY(" + translateY + "px)"; } }; diff --git a/core/modules/macros/zoomer.js b/core/modules/macros/zoomer.js index cdf15ee8a..9bd9c1c91 100644 --- a/core/modules/macros/zoomer.js +++ b/core/modules/macros/zoomer.js @@ -30,11 +30,11 @@ exports.stopZoomer = function() { var newScrollY = this.yFactor * (this.bodyHeight - this.windowHeight); this.inZoomer = false; window.scrollTo(0,newScrollY); - document.body.style.webkitTransform = "translateY(" + newScrollY * this.xFactor + "px) " + + document.body.style[$tw.browser.transform] = "translateY(" + newScrollY * this.xFactor + "px) " + "scale(" + this.scale + ") " + "translateY(" + ((this.windowHeight / this.scale) - this.bodyHeight) * this.yFactor * this.xFactor + "px)"; $tw.utils.removeClass(document.body,"in-zoomer"); - document.body.style.webkitTransform = "translateY(0) scale(1) translateY(0)"; + document.body.style[$tw.browser.transform] = "translateY(0) scale(1) translateY(0)"; }; /* @@ -42,7 +42,7 @@ Zoom the body element given a touch/mouse position in screen coordinates */ exports.hoverZoomer = function(x,y) { // Put the transform origin at the top in the middle - document.body.style.webkitTransformOrigin = "50% 0"; + document.body.style[$tw.browser.transformorigin] = "50% 0"; // Some shortcuts this.bodyWidth = document.body.offsetWidth; this.bodyHeight = document.body.offsetHeight; @@ -77,7 +77,7 @@ exports.hoverZoomer = function(x,y) { var transform = "translateY(" + preTranslateY.toFixed(8) + "px) " + "scale(" + scale.toFixed(8) + ") " + "translateY(" + postTranslateY.toFixed(8) + "px)"; - document.body.style.webkitTransform = transform; + document.body.style[$tw.browser.transform] = transform; }; exports.handleEvent = function(event) {