From 7bfb96c1c061c4179c875573033ad800fb16c002 Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Mon, 30 Jul 2012 16:13:42 +0400 Subject: [PATCH] fixed zooming, some render problems in webkit (zoom did not have these\!); we are still getting some positioning errors due to sub-pizel accumolation, find a way around this... Signed-off-by: Alex A. Naanou --- ui/ui.js | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/ui/ui.js b/ui/ui.js index 91d4687d..c6683437 100755 --- a/ui/ui.js +++ b/ui/ui.js @@ -201,19 +201,28 @@ function fieldSize(W, H){ /*********************************************************************/ -// NOTE: this will only return a single scale/zoom value... +// NOTE: this will only return a single scale value... function getElementScale(elem){ - var zoom = elem.css('zoom') + //var transform = elem.css('transform') + var vendors = ['o', 'moz', 'ms', 'webkit'] var transform = elem.css('transform') var res - // get the scale value... - if( (/scale\(/).test(transform) ){ - res = (/scale\((.*),.*\)/).exec(transform)[1] - } else { - res = zoom + // go through vendor prefixes... (hate this!) + if(!transform || transform == 'none'){ + for(var i in vendors){ + transform = elem.css('-' + vendors[i] + '-transform') + if(transform && transform != 'none'){ + break + } + } } - return res + // no transform is set... + if(!transform || transform == 'none'){ + return 1 + } + // get the scale value -- first argument of scale/matrix... + return parseFloat((/(scale|matrix)\(([^,]*),.*\)/).exec(transform)[2]) } // XXX function setElementScale(elem, scale){