Hey all,

Jared Wein (jaws) recommended I ask this question here.

As a student project, we implemented touch gesture rotation for ImageDocuments 
in Nightly, it's targeted for Firefox 21 (I think?).  We're currently working 
on an add-on to implement pinch zoom, as well as double-tap zoom (OSX).  The 
reason we're doing an add-on is because off-main-thread-compositing isn't ready 
yet and is nowhere near our one-semester timeline.  The add-on is essentially a 
temporary solution.

Here's the issue:

The rotation feature is in Nightly.  It rotates the image by applying CSS 
"transform: rotate(...)".

The zoom features are in our add-on.  They scale image elements directly, by 
applying CSS "transform: scale(...)".

If zoom doesn't also calculate the rotation from the computed style for the 
image element, then the rotation gets wiped out by the zoom.  This is easy to 
fix--get the image element's computed style, calculate rotation, and apply 
"transform: scale(...) rotate(...)".  As an add-on, it's responsible for 
respecting existing functionality of the browser.

However, gesture rotation doesn't *have* to respect the functionality of any 
add-on.  When the rotation sets "transform: rotate(...)", it will wipe out the 
"scale(...)".  As it stands, if you zoom in on an image using our add-on, and 
then rotate, the image jumps to 100% scale for the rotation.  When you start 
another zoom, it jumps again.  Needless to say this is ugly.

The best solution I can propose is this:

Patch rotation so that it computes the scale--which does not require any add-on 
to exist and will assume scale is 1 if "transform" is not set.  I'm torn 
because this essentially *implies* that the add-on exists, even though it does 
not require it.  It seems like bad form to imply the existence of a specific 
add-on, but if y'all feel that this is general enough to include, let me know.

The only alternative is to ignore the issue, but that would damage the 
useability of the add-on.  Additionally, directly referencing the add-on is 
obviously not an option.

Thanks for your time and input!

~Brandon Waterloo
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to