[email protected]
[Top] [All Lists]

Re: Select an element and draw it on the canvas without updating the svg

Subject: Re: Select an element and draw it on the canvas without updating the svg
From: "Helder Magalhães"
Date: Sun, 13 Jul 2008 11:33:01 +0100
> i tried what thomas suggested and it worked but its still cpu intensive.. how
> can i make dragging an element more efficient? i read that i can use
> overlays but when i looked at the cpu usage, its almost the same as updating
> the dom... any suggestions?
Dragging complex elements can be a pain - the usage CPU usage is
probably not due to efficiency reasons but due to the likely
complexity present in the dragged object.

Have you considered implementing canvas object drag? Suggestion was to
get the object's bounding box and use this rectangle to set the new
object location. Once the rectangle was dropped, a single DOM
operation would relocate the original object into position. :-) This
already seen in the commonly seen "Show window contents while
dragging" system preference (this specific one is present in Windows):
if enabled, CPU usage while dragging windows is also somehow high...

An even better approach would be using a wireframe-like [1] approach,
that is, collecting (through cloning?) line data and setting a simple
stroke for the whole line set. Avoiding potentially used filters, more
complex stroke and fill will probably result in a noticeable
performance boost! ;-) The only caveat which occurs to me is the
initial setup of drag operation, which may cause all this to be
unfeasible... But I believe the idea worths the effort! :-) Batik
developers: if still not present in Batik framework, implementing a
few utility methods for this would surely be great for these kind of
operations! ;-) (Should this be but somewhere in the Wiki [2] as a
possible idea for contributions? Is there a recommended location,
within the Wiki or not, for these kind of thoughts?)

Hope this helps,

 Helder Magalhães

[1] http://en.wikipedia.org/wiki/Wire_frame_model
[2] http://wiki.apache.org/xmlgraphics-batik/

To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

<Prev in Thread] Current Thread [Next in Thread>