mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-12-24 17:10:29 +00:00
Reordered helper functions
This commit is contained in:
parent
adf83e71de
commit
2083b7959e
@ -26,17 +26,6 @@ exports.startZoomer = function(x,y) {
|
|||||||
$tw.utils.addClass(document.body,"in-zoomer");
|
$tw.utils.addClass(document.body,"in-zoomer");
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.stopZoomer = function() {
|
|
||||||
var newScrollY = this.yFactor * (this.bodyHeight - this.windowHeight);
|
|
||||||
this.inZoomer = false;
|
|
||||||
window.scrollTo(0,newScrollY);
|
|
||||||
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[$tw.browser.transform] = "translateY(0) scale(1) translateY(0)";
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Zoom the body element given a touch/mouse position in screen coordinates
|
Zoom the body element given a touch/mouse position in screen coordinates
|
||||||
*/
|
*/
|
||||||
@ -80,6 +69,17 @@ exports.hoverZoomer = function(x,y) {
|
|||||||
document.body.style[$tw.browser.transform] = transform;
|
document.body.style[$tw.browser.transform] = transform;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
exports.stopZoomer = function() {
|
||||||
|
var newScrollY = this.yFactor * (this.bodyHeight - this.windowHeight);
|
||||||
|
this.inZoomer = false;
|
||||||
|
window.scrollTo(0,newScrollY);
|
||||||
|
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[$tw.browser.transform] = "translateY(0) scale(1) translateY(0)";
|
||||||
|
};
|
||||||
|
|
||||||
exports.handleEvent = function(event) {
|
exports.handleEvent = function(event) {
|
||||||
switch(event.type) {
|
switch(event.type) {
|
||||||
case "touchstart":
|
case "touchstart":
|
||||||
|
Loading…
Reference in New Issue
Block a user