how to disable don't want to drag n drop

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • liangchen76
    New Member
    • May 2008
    • 2

    how to disable don't want to drag n drop

    Hey,

    I am writing a web app to allow users to draw over an image. The workflow of drawing a rectangle is:
    1. click a mouse button
    2. hold and drag
    3. while the mouse moving, the size of a rectange will change.
    4. once a mouse button is released, the rectangle stays.

    I am having a problem with #2. In firefox, every time i tried to hold a mouse button and drag, firefox seemed thinking i was trying to drag the image underneath and turned the cursor to "STOP". And I lost the mouse down event.

    any idea? thanks
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    You need to stop the propagation of events using the stopPropagation () method (W3C) or cancelBubble = false (Microsoft). See this link.

    Comment

    • liangchen76
      New Member
      • May 2008
      • 2

      #3
      thanks for reply, acorder.

      I am not sure it involves event bubble or propagation, because all mouse events are tied to the image. I did use in IE setCapture/releaseCapture to redirect all event firing to the same set of handlers. So the code works fine in IE.

      Originally posted by acoder
      You need to stop the propagation of events using the stopPropagation () method (W3C) or cancelBubble = false (Microsoft). See this link.

      Comment

      • hsriat
        Recognized Expert Top Contributor
        • Jan 2008
        • 1653

        #4
        If you are doing it like this:
        onmousedown="dr awOverImage();"

        Add return false, like this
        onmousemove="dr awOverImage();return false;"

        where drawOverImage() is the function you have made.

        Comment

        • acoder
          Recognized Expert MVP
          • Nov 2006
          • 16032

          #5
          If that doesn't work, post your code.

          Comment

          Working...