Drag event in firefox.

57 views
Skip to first unread message

Alejandro_UA

unread,
Oct 20, 2011, 10:53:20 AM10/20/11
to SVG Web
Greetings Guys, I can not solve a problem with dragging svg object.
The problem is:
I have a drawing of a floor in an svg file, set event handlers for it,
but when I start dragging it, it works wrong only in FireFox. It
looks like, I click and then move mouse without pressing a left button
and drawing become moving. Here is some code.
function onMouseDown(event) {
if (_currentSVGObject && isViewMode() && !_dragging) {
isDownEvent = true;
prepareGlassDivPosition();
enableGlassDivListeners(true);
enableSvgListeners(true);
trackStartDraggingCoords(event);
Utils.stopEvent(event);
}
}

function onMouseMove(event) {
if (isDownEvent) {
drag = true;
var coords = Utils.getEventXY(event),
shiftPos = calcShiftPosition(coords.x, coords.y);
updateContainerPosition(shiftPos.x + "px", shiftPos.y + "px");
Utils.stopEvent(event);
}
}


function onMouseUp(event) {
if (isDragging()) {
drag = false;
isDownEvent = false;
moveContainer(event);
disableListeners();
Utils.stopEvent(event);
}
}

Sy

unread,
Oct 20, 2011, 12:14:52 PM10/20/11
to SVG Web
Take a look at my svggui demo http://svggui.com/demo/virDesktop.php
you can drag the window around the display area, as far as I know it
works in all browsers, you are welcome to look at the script and
borrow anything you like.

Alejandro_UA

unread,
Oct 21, 2011, 3:02:22 AM10/21/11
to SVG Web
Thanks for advece, I looked at the page in FireFox it has the same
problem ... (

On Oct 20, 7:14 pm, Sy <simonaplat...@googlemail.com> wrote:
> Take a look at my svggui demohttp://svggui.com/demo/virDesktop.php

Simon Platten

unread,
Oct 21, 2011, 3:11:56 AM10/21/11
to svg...@googlegroups.com
What version of firefox are you using, I developed this in Firefox 3 and now up to Firefox 8 and the drag and drop works perfectly.  Also tested in IE9, Opera and Chrome.

Can you be more specific about your problem?


--
You received this message because you are subscribed to the Google Groups "SVG Web" group.
To post to this group, send email to svg...@googlegroups.com.
To unsubscribe from this group, send email to svg-web+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/svg-web?hl=en.




--
Regards,
Sy

Alejandro_UA

unread,
Oct 26, 2011, 5:35:54 AM10/26/11
to SVG Web


I have an svg object in div class html, when I start drag it drags
normal, then i have roomObjectClickHandler
/** Click event handler for room path id object. */
function roomObjectClickHandler(e) {
if (isNotDragging()) {
id = getRoomAttrId(e);
if (_clickHandlersArr[id]) {
_clickHandlersArr[id](id);
}
/* Firing external click handler. */
if (_documentClickHandler) {
var newEvent = Utils.parseEvent(e, _container);
_documentClickHandler(id, newEvent.x, newEvent.y);
}
}
}

When I click this event fire, but when I move mouse all draving moving
with mouse. And this efect only in firefox.. IE, OPERA, CHROME work
normal.

On Oct 21, 10:11 am, Simon Platten <simonaplat...@googlemail.com>
wrote:
> What version of firefox are you using, I developed this in Firefox 3 and now
> up to Firefox 8 and the drag and drop works perfectly.  Also tested in IE9,
> Opera and Chrome.
>
> Can you be more specific about your problem?
>

Sy

unread,
Oct 26, 2011, 8:00:36 AM10/26/11
to SVG Web
Its difficult to help you with just this fragment of code, do you have
an online example of it, where I can see it in full?

Alejandro_UA

unread,
Oct 26, 2011, 10:45:06 AM10/26/11
to SVG Web
Project still not hosted, but i can give you my skype account name,
and share a screen.
Reply all
Reply to author
Forward
0 new messages