735
745
this.onMouseMoveBind = this.onMouseMove.bindAsEventListener( this );
736
746
Event.observe( this.dragArea, 'mousemove', this.onMouseMoveBind );
737
747
this.onMouseOutBind = this.onMouseOut.bindAsEventListener( this );
738
Event.observe( this.dragArea, 'mouseout', this.onMouseOutBind );
748
Event.observe( document, 'mouseout', this.onMouseOutBind );
751
if(this.options.onTouchStart){
752
this.onTouchStartBind = this.onTouchStart.bindAsEventListener(this);
753
Event.observe(this.dragArea,'touchstart',this.onTouchStartBind);
755
if(this.options.onTouchMove){
756
this.onTouchMoveBind = this.onTouchMove.bindAsEventListener(this);
757
Event.observe(this.dragArea,'touchmove',this.onTouchMoveBind);
759
if(this.options.onTouchEnd){
760
this.onTouchEndBind = this.onTouchEnd.bindAsEventListener(this);
761
Event.observe(this.dragArea, 'touchend',this.onTouchEndBind);
763
if(this.options.onGestureStart){
764
this.onGestureStartBind = this.onGestureStart.bindAsEventListener(this);
765
Event.observe(this.dragArea,'gesturestart',this.onGestureStartBind);
767
if(this.options.onGestureMove){
768
this.onGestureMoveBind = this.onGestureMove.bindAsEventListener(this);
769
Event.observe(this.dragArea,'gesturechange',this.onGestureMoveBind);
771
if(this.options.onGestureEnd){
772
this.onGestureEndBind = this.onGestureEnd.bindAsEventListener(this);
773
Event.observe(this.dragArea,'gestureend',this.onGestureEndBind);
775
if(this.options.onOrientationChange){
776
this.onOrientationChangeBind = this.onOrientationChange.bindAsEventListener(this);
777
Event.observe(this.dragArea,'orientationchange',this.onOrientationChangeBind);
741
781
this.endCropBind = this.endCrop.bindAsEventListener( this );
742
782
Event.observe( document, 'mouseup', this.endCropBind );
743
783
// Event.observe( this.imgWrap, 'mouseup', this.endCropBind );
914
954
Event.stopObserving( document, 'mousemove', this.onMouseMoveBind );
915
955
Event.stopObserving( document, 'mouseout', this.onMouseOutBind );
958
if(this.options.onTouchStart){
959
Event.stopObserving(this.dragArea,'touchstart',this.onTouchStartBind);
961
if(this.options.onTouchMove){
962
Event.stopObserving(this.dragArea,'touchmove',this.onTouchMoveBind);
964
if(this.options.onTouchEnd){
965
Event.stopObserving(this.dragArea,'touchend',this.onTouchEndBind);
968
if(this.options.onGestureStart){
969
Event.stopObserving(this.dragArea,'gesturestart',this.onGestureStartBind);
971
if(this.options.onGestureMove){
972
Event.stopObserving(this.dragArea,'gesturemove',this.onGestureMoveBind);
974
if(this.options.onGestureEnd){
975
Event.stopObserving(this.dragArea,'gestureend',this.onGestureEndBind);
977
if(this.options.onOrientationChange){
978
Event.stopObserving(this.dragArea,'orientationchange', this.onOrientationChange);
917
981
Event.stopObserving( document, 'mouseup', this.endCropBind );
918
982
// Event.stopObserving( this.imgWrap, 'mouseup', this.endCropBind );
919
983
Event.stopObserving( this.dragArea, 'dblclick', this.dblClickBind );
1578
1642
Event.stop( e );
1645
onTouchStart: function(e){
1647
var pos = this.getCurTouchPos(e);
1648
this.options.onTouchStart(e,pos);
1650
onTouchMove: function(e){
1652
var xpos = this.getCurTouchPos(e);
1653
this.options.onTouchMove(e,xpos);
1655
onTouchEnd: function(e){
1656
this.options.onTouchEnd(e);
1658
onGestureStart: function(e){
1659
this.options.onGestureStart(e);
1661
onGestureMove: function(e){
1663
var scale = e.scale;
1664
this.options.onGestureMove(e,scale);
1666
onGestureEnd: function(e){
1667
var scale = e.scale;
1668
var angle = e.rotation;
1669
this.options.onGestureEnd(e,scale,angle);
1672
onOrientationChange: function(e){
1673
this.options.onOrientationChange(e);
1676
Prevent: function(e){
1680
/** Gets touchposition
1681
* returns an Object.
1683
getCurTouchPos: function(e){
1684
var curpos = new Object();
1685
var el = this.imgWrap, wrapOffsets = Position.cumulativeOffset(el);
1687
curpos.x = e.targetTouches[0].clientX - wrapOffsets[0];
1688
curpos.y = e.targetTouches[0].clientY - wrapOffsets[1];
1582
1696
* Starts the drag
1584
1698
* @access private