W3C home > Mailing lists > Public > www-svg@w3.org > March 2009

Drag group of elements and line end

From: Age Bosma <agebosma@gmail.com>
Date: Wed, 4 Mar 2009 11:34:02 +0100
Message-ID: <d2b2606c0903040234h20270eb7kdae411d092a47383@mail.gmail.com>
To: www-svg@w3.org
Hi,

I'm not a 100% sure that this mailing list is intended for these kind
of questions but due to the lack of a suitable dedicated mailing list
or forum I hope this will fall under the 'other deliverables' purpose
category of this mailing list (whatever it means exactly ;-) ). Even
though I'm using Batik SVG, this is more of a SVG and/or DOM matter.

I've got a group of elements, lets say a car, on a Batik JSVGCanvas. A
strait line should go from that group to a specific point, to indicate
its destination. The end point of the line is always the center of the
map. This line can be just one strait line for the time being but in
the future I'd like to make it possible to click on any position of
the line and drag that point to a different location to create
intermediate destination point. The latter, however, is a different
topic. There can also be more then one car on the map.
What I'd like to create is the possibility to drag the car to a
different position and by that, the start of the line has to move as
well. I'm a bit stuck on how to do this though.

Using Java would be the logical thing to do. This is because of the
updating of the properties dialog of the car. I.e. if I double click
on the car, a properties dialog should appear allowing you to change
the car settings and also the position of the car. Using JavaScript
for the dragging would only complicate this communication as far as I
can tell but correct me if I'm wrong.
The dragging of the group of elements should not be too hard. The
approach explained on XML.com [1] looks usable, the only thing I'd
have to add would be determining if a car is clicked or not. If yes,
start moving it. Or would a different approach be more appropriate?
What would be a sane approach to moving the line starting point?
Including the line or path element in the car group element would
cause the complete line to move along with the car, thus moving the
destination point.
Because of the future alterations I will have to use the path element.
There's also no way of knowing the end point, or first intermediate
point, in advance. Completely redrawing the path would therefor be not
an option IMHO, or it would at least be the difficult way of doing it.
Is there some way to 'attach' the line starting point with the group?
How can I determine and move just the line starting point?

I hope you can give me some advise on how to proceed.

Yours,

Age


[1] http://www.xml.com/pub/a/2002/02/27/drag.html
Received on Wednesday, 4 March 2009 10:34:42 GMT

This archive was generated by hypermail 2.3.1 : Friday, 8 March 2013 15:54:41 GMT