SOLVED Mojo drawing tools: rotate, origin point argument
-
Hi there, I'm trying to specify an origin point for rotation with mojo drawing tools. Is this possible? I can get around this by rotating on (0,0) and then translating, but of course accustomed to DrawBot.
RF docs:
rotate(angle)
Rotate the canvas around the origin point with a given angle in degrees.DB docs:
rotate(angle, center=(0, 0))
Rotate the canvas around the center point (which is the origin by default) with a given angle in degrees.Thanks!
Ryan
-
Understood. Thanks @frederik !
-
savedState()
will be added :)
-
Some DrawBot api callback are indeed super handy to have while drawing in RF. But supporting all DrawBot apis will be overkill...
mojo.drawingTools
is a simplified set of DrawBot as not every method is usefull in a view based canvas.
-
Thanks @gferreira and @frederik! While we're on the subject, it'd be great to have the two libraries pretty much synonymous, if there isn't any reason not to. For instance,
savedState()
in DrawBot vs deprecatedsave()
&restore()
.
-
added! will be there in the next beta and release!
thanks
-
hello @ryan,
the
rotate()
command inmojo.drawingTools
does not support thecenter
argument. (I wasn’t aware of it in DrawBot until now :)you can achieve the same result by translating to the desired rotation center, applying the rotation, and then translating back to the previous position:
translate(x, y) rotate(angle) translate(-x, -y)
I think it would make sense to add
center
tomojo.drawingTools
too, so that both APIs are the same. I’ve created an issue for it.thanks!