jmpressjs / jmpress.js

A jQuery plugin to build a website on the infinite canvas
http://jmpressjs.github.com/jmpress.js
1.5k stars 237 forks source link

customizable order for rotations & transformations #93

Open mlarcher opened 11 years ago

mlarcher commented 11 years ago

It can come in handy to be able to force the rotation on the Y axis to occur before the one on the X axis, or to apply rotations before applying translations. This pull request handles those cases, and won't interfere with the default behaviour.

It adds the following options :

rotateOrder: 'xyz' Its value is a string that can be any combination of x,y and z. Translations will be applied in that order.

transformOrder: 'trs' Its value is a string that can be any combination of t, r and s. t stands for translate, r for rotate and s for scale. Transformations will be applied in that order.

sokra commented 11 years ago

I like the idea to make it more flexible.



Using different orders in steps may cause weird translations between them...

mlarcher commented 11 years ago

I'm sure there could be some optimizations :) I tried to stay as close as possible to the existing code, a more efficient rewrite would require more drastic changes. Are you ok with this ? Also, what do you mean by "It should use the transforms of the parent" ? Those arrays are taken from what was there, I just stuck them to variables in order to reuse them without having to repeat myself. I agree the switch could me more compact too, I'll see to it as soon as I find some time for it.

gaurav21r commented 10 years ago

+1 IS this going to be merged?