targetclick (drag)

Help
Anonymous
2012-02-23
2012-10-06
  • Anonymous - 2012-02-23

    Related to my other query on obtaining the mouse coordinates. I set up a
    targetclick event similar to the v1.1 blend example such than when the mouse
    was clicked an alert would display the x,y. When doing this in iipmooviwer 2.0
    as well as mouse clicks triggering the alert, click drags also trigger the
    alerts. In v1.1 click/drags don't trigger the alerts.

    Is this different behaviour expected. My aim is to log the coords to another
    div but I don't won't click/drags logged.

    Thanks
    Mike

     
  • Ruven

    Ruven - 2012-02-27

    OK, I'll look into this. The behaviour should be the same in iipmooviewer 2.0.

     
  • Anonymous - 2012-03-01

    Hi Ruven

    I've been trying to see myself if I can differentiate between the click and
    click/drag in iipmooviewer 2.0 but am getting no where :(

    So if you can look at it that would be great.

    Cheers
    Mike

     
  • Ruven

    Ruven - 2012-03-07

    OK, I've found a solution! Recent versions of Mootools handle this
    differently, so the way round it is to modify the code where the targetclick
    event is added to use mouseup instead of click and to have this disabled
    during dragging:

        // Add an external callback if we have been given one
        if( this.targetclick ){
    
          var fn = this.targetclick.bind(this);
          this.canvas.addEvent( 'mouseup', fn );
    
          this.touch.addEvents({
        start: function(e){ _this.canvas.removeEvents( 'mouseup' ); },
        complete: function(e){ _this.canvas.addEvent( 'mouseup', fn ); }
          });
        }
    

    This will, of course, be integrated into the full version 2.0 release.

     
  • Anonymous - 2012-03-07

    Hi Ruven

    Many thanks for this.

    Mike

     


Anonymous

Cancel  Add attachments