1. #1
    Ext User
    Join Date
    Oct 2009
    Posts
    72
    Vote Rating
    0
    harmomelodic is on a distinguished road

      0  

    Question Losing drag proxy in embed...mouse speed related.

    Losing drag proxy in embed...mouse speed related.


    Howdy. Thanks in advance for your help.

    I am using DDProxy to drag an icon around. When I am dragging the icon over the toolbar, it works fine, but when I drag it over an embedded graph <embed src= et. /> I 'lose' the icon and it hangs (the icon, not the browser). Interestingly, this is related to the direction of the drag and the positioning of the mouse over the proxy el. I.e. if I setDelta(middle, middle) in my startDrag override, it becomes far less sensitive to losing the icon. When I setDelta() to the corner of the proxy it becomes extremely sensitive (and that is unfortunately what I need).

    I suspect the onMouseMove code within my embed is interfering with the dragging code...and that it is a timing issue. Unfortunately my intention is to make the onMouseMove code more complicated, not less (I'm adding some fairly complex functionality to an already complex page).

    Any thoughts on how I can workaround this problem would be appreciated.
    The embed does live within an ext panel, if that helps at all...

  2. #2
    Ext User
    Join Date
    Oct 2009
    Posts
    72
    Vote Rating
    0
    harmomelodic is on a distinguished road

      0  

    Default


    So I think I know 'how' to fix this, but I'm not sure how to implement it.
    The embed seems to play havok with mousemove type events. I tried to move all the onmousemove code to the container that encapsulates the embed (container_var.getEl.addListener('mousemove', function), and it performed terribly (the event would fire intermittently only when crossing container boundaries).
    My thinking here is I should turn this around and override the DDProxy mousemove event handler so that the embed code is calling it when I'm in the embed.
    My question....how do I do this? How do I manually capture and forward the mousemove events to DDProxy when in the embed, but let Ext do it when not in the embed?
    Thanks...

  3. #3
    Ext User
    Join Date
    Oct 2009
    Posts
    72
    Vote Rating
    0
    harmomelodic is on a distinguished road

      0  

    Default


    I'm calling a delegate of ext.dd.DragDropMgr.handleMouseMove(evt).
    However, it expects an Ext wrapped event, not a browser event.
    Is there a way I can easily wrap this...a browser event->ext event converter???

  4. #4
    Ext User
    Join Date
    Oct 2009
    Posts
    72
    Vote Rating
    0
    harmomelodic is on a distinguished road

      0  

    Default


    It appears Ext.EventObject.setEvent(browserevent) will do this.
    Now a related problem crops up...the value for clientY in the onmousemove event for the embed is relative to the embed, not the document. I cannot set a getter...so I'm not sure what the best way to deal with this is...make a writable copy of the event? Is their an easier way?

  5. #5
    Ext User
    Join Date
    Oct 2009
    Posts
    72
    Vote Rating
    0
    harmomelodic is on a distinguished road

      0  

    Default


    If I do make a copy (new Object(browserevent)) I get the strange error...too much recursion. I guess the object is way too deep.
    Any thoughts on how to correct for the misplacement of the y axis in the embed's onmousemove?
    I feel like I'm really close here. The dragged icon does not get lost over the embed anymore (it doesn't hang), rather it is just offset by the size of the toolbar (or double it)..........

    Sigh...

  6. #6
    Ext User
    Join Date
    Oct 2009
    Posts
    72
    Vote Rating
    0
    harmomelodic is on a distinguished road

      0  

    Default


    I'm looking for a place to override the code that 'pulls' the proxy element back under the mouse so that I can add an offset to the event that I can look for in that code.
    Where does this code live? I'm searching and having some trouble finding it...

  7. #7
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,508
    Vote Rating
    57
    Animal has a spectacular aura about Animal has a spectacular aura about Animal has a spectacular aura about

      0  

    Default


    I think you're barking up the wrong tree.

    You will have to mask the plugin object with a regular position:absolute div.

    Place it on drag start, remove it on drag end.

  8. #8
    Ext User
    Join Date
    Oct 2009
    Posts
    72
    Vote Rating
    0
    harmomelodic is on a distinguished road

      0  

    Default


    Wrong tree indeed.
    Thank you animal, this worked beautifully.
    I included a div in the pages base html with 'display:none and z-index:+' and set its box and display: block in startDrag, and back again in endDrag.
    I used document.getElementById() to change its settings...which works great.
    Is there a more 'ext' way of doing this, and is there any reason to use it instead of this approach?

  9. #9
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,508
    Vote Rating
    57
    Animal has a spectacular aura about Animal has a spectacular aura about Animal has a spectacular aura about

      0  

    Default


    This is "the" way to do it.

    And you are using Ext to do it (Aren't you?), so it's an Ext way.

  10. #10
    Ext User
    Join Date
    Oct 2009
    Posts
    72
    Vote Rating
    0
    harmomelodic is on a distinguished road

      0  

    Default


    I just meant my implementation of your mask idea. It wasn't obvious to me how to use Ext's DOM wrappers to insert the div, pull it out, manipulate it. Nor was it obvious if there was any real benefit to that vs. GetElementById(), setAttribute() and having the <div> in the page body ready to go.

Similar Threads

  1. Replies: 4
    Last Post: 20 May 2010, 12:46 AM
  2. Drag Proxy vs. Mouse location
    By gtomalesky in forum Ext 2.x: Help & Discussion
    Replies: 1
    Last Post: 28 Oct 2008, 2:27 PM
  3. graphical dd proxy under the mouse cursor
    By zen in forum Ext 2.x: Help & Discussion
    Replies: 0
    Last Post: 21 Aug 2008, 2:52 AM
  4. drag-proxy
    By yazan_rababa in forum Ext 2.x: Help & Discussion
    Replies: 2
    Last Post: 1 Jun 2008, 4:53 AM
  5. Custom Mouse Selection Proxy Box Help (jQuery)
    By xtrafile in forum Ext 1.x: Help & Discussion
    Replies: 0
    Last Post: 16 Jul 2007, 7:01 PM

Thread Participants: 1