1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-09-27 22:58:19 +00:00

Changes the chooser and the zoomer to use the browser prefix mechanism

This commit is contained in:
Jeremy Ruston 2012-06-07 13:29:16 +01:00
parent e2707ae49d
commit adf83e71de
2 changed files with 6 additions and 8 deletions

View File

@ -89,10 +89,8 @@ exports.hoverChooser = function(x,y) {
var scale = scaleFactor * expandFactor, var scale = scaleFactor * expandFactor,
translateX = x > 16 ? 0 : -(((16-x)/16) * widthPanel) / scale, translateX = x > 16 ? 0 : -(((16-x)/16) * widthPanel) / scale,
translateY = (y / scale) - ((y/window.innerHeight) * heightPanel); translateY = (y / scale) - ((y/window.innerHeight) * heightPanel);
domPanel.style.webkitTransformOrigin = domPanel.style[$tw.browser.transformorigin] = "0 0";
domPanel.style.MozTransformOrigin = "0 0"; domPanel.style[$tw.browser.transform] = "scale(" + scale + ") translateX(" + translateX + "px) translateY(" + translateY + "px)";
domPanel.style.webkitTransform =
domPanel.style.MozTransform = "scale(" + scale + ") translateX(" + translateX + "px) translateY(" + translateY + "px)";
} }
}; };

View File

@ -30,11 +30,11 @@ exports.stopZoomer = function() {
var newScrollY = this.yFactor * (this.bodyHeight - this.windowHeight); var newScrollY = this.yFactor * (this.bodyHeight - this.windowHeight);
this.inZoomer = false; this.inZoomer = false;
window.scrollTo(0,newScrollY); 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 + ") " + "scale(" + this.scale + ") " +
"translateY(" + ((this.windowHeight / this.scale) - this.bodyHeight) * this.yFactor * this.xFactor + "px)"; "translateY(" + ((this.windowHeight / this.scale) - this.bodyHeight) * this.yFactor * this.xFactor + "px)";
$tw.utils.removeClass(document.body,"in-zoomer"); $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) { exports.hoverZoomer = function(x,y) {
// Put the transform origin at the top in the middle // 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 // Some shortcuts
this.bodyWidth = document.body.offsetWidth; this.bodyWidth = document.body.offsetWidth;
this.bodyHeight = document.body.offsetHeight; this.bodyHeight = document.body.offsetHeight;
@ -77,7 +77,7 @@ exports.hoverZoomer = function(x,y) {
var transform = "translateY(" + preTranslateY.toFixed(8) + "px) " + var transform = "translateY(" + preTranslateY.toFixed(8) + "px) " +
"scale(" + scale.toFixed(8) + ") " + "scale(" + scale.toFixed(8) + ") " +
"translateY(" + postTranslateY.toFixed(8) + "px)"; "translateY(" + postTranslateY.toFixed(8) + "px)";
document.body.style.webkitTransform = transform; document.body.style[$tw.browser.transform] = transform;
}; };
exports.handleEvent = function(event) { exports.handleEvent = function(event) {