Rotate is behaving awkwardly when applying flip functionality to an svg image.

207 views
Skip to first unread message

Kalavathis .b

unread,
Aug 4, 2016, 3:40:23 AM8/4/16
to JointJS
I want to enable a feature called Flip on X axis for an element (Similar to what happens in Adobe Illustrator)

I am trying this to flip the image

jQuery('#btn-flip').on('mousedown', _.bind(function (evt) {
            jQuery.each(this.selection.models, function (modelCounter, model) {
                var currentBbox = model.getBBox();
                var x = currentBbox.x;
                var y = currentBbox.y;
                var width = model.attributes.size.width;
                var pos = x + width;
                jQuery("[model-id='" + this.id + "']").attr("transform", "translate(" + pos + "," + y + ")scale(-1,1)");
            });
        }, this));



Flip is working as expected but when i try to rotate an image after flip,It is getting rotated in opposite direction of Halo rotate.
(means if I rotate Halo in clockwise ,image is rotating in anticlockwise -ref below image).




Is there s feature in JointJS that already does this..?? Dont you guys think that this is basic function that is needed,.?? (I  searched in the API documentation could not find a function that could do this for me.)

I want to alter the Halo's feature to rotate in the AntiClockwise if an element has been flipped (I believe this can be done by just rotating the object with the same angle but with a negetive)

Roman Bruckner

unread,
Aug 4, 2016, 5:29:31 AM8/4/16
to joi...@googlegroups.com
Hi,

element flipping is currently not supported in JointJS (It's on our roadmap though). For now please take a look at the following JSFiddle, that shows a workaround for the flip functionality.


When you rotate `cylinder` and `flippedCylinder` elements they both rotate in the same direction. So it might be a bug in your implementation.

Best,
Roman

--

---
You received this message because you are subscribed to the Google Groups "JointJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jointjs+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--

Kalavathis .b

unread,
Aug 4, 2016, 6:56:41 AM8/4/16
to JointJS
Your thing for flip is working but still facing same rotate issue(when Halo rotates clockwise but image rotates anticlockwise).

Roman Bruckner

unread,
Aug 4, 2016, 7:30:42 AM8/4/16
to joi...@googlegroups.com
Unfortunately I can't reproduce it.


Best,
Roman

--

---
You received this message because you are subscribed to the Google Groups "JointJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jointjs+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Kalavathis .b

unread,
Aug 5, 2016, 2:34:22 AM8/5/16
to JointJS
That worked a charm thanks. 
and thank you for such a quick reply as well. 


On Thursday, August 4, 2016 at 1:10:23 PM UTC+5:30, Kalavathis .b wrote:

Kalavathis .b

unread,
Aug 10, 2016, 12:42:14 AM8/10/16
to JointJS
Hi After Flip on X axis as you suggested in http://jsfiddle.net/kumilingus/e8zhd76s/  "remove ('X')" on Halo not working.

Means When I click on 'X' Mark the Element is not getting removed .




Please Help


On Thursday, August 4, 2016 at 1:10:23 PM UTC+5:30, Kalavathis .b wrote:

Vladimír Talaš

unread,
Aug 12, 2016, 3:39:41 PM8/12/16
to joi...@googlegroups.com
Hi, 

I've noticed there is a option `handles` in demo, with only one handle - rotate.
I added the remove handler http://jsfiddle.net/vtalas/sq7hvtqo/

Regrads,
 

--

---
You received this message because you are subscribed to the Google Groups "JointJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jointjs+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Vladimir Talas
Client IO

Kalavathis .b

unread,
Aug 19, 2016, 4:57:17 AM8/19/16
to JointJS
Hi after flip on X axis as you suggested in http://jsfiddle.net/vtalas/sq7hvtqo/  flip is working as expected ,but when i resize the image using Halo around it Flipped image again changing to original(in the same direction before it was flipped-flipped thing not retaining)



On Thursday, August 4, 2016 at 1:10:23 PM UTC+5:30, Kalavathis .b wrote:
Reply all
Reply to author
Forward
0 new messages