Skip to content

Commit

Permalink
fix: cancel mousedrag event when either a mouseup or mousedown event …
Browse files Browse the repository at this point in the history
…fires
  • Loading branch information
Matt Lewis committed Jun 26, 2016
1 parent 1af705a commit c76be59
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions demo/demo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import {Resizable, ResizeEvent, ResizeHandle} from './../angular2-resizable';
[ngStyle]="style"
mwl-resizable
[validateResize]="validate"
[resizeEdges]="{bottom: true, right: true, top: true, left: true}"
(onResizeEnd)="onResizeEnd($event)">
<img
src="http://i.imgur.com/eqzz2dl.gif"
Expand Down
3 changes: 2 additions & 1 deletion src/resizable.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
} from '@angular/core';
import {Subject} from 'rxjs/Subject';
import {Observable} from 'rxjs/Observable';
import {merge} from 'rxjs/observable/merge';
import 'rxjs/add/operator/map';
import 'rxjs/add/operator/mergeMap';
import 'rxjs/add/operator/takeUntil';
Expand Down Expand Up @@ -193,7 +194,7 @@ export class Resizable implements OnInit, AfterViewInit {
mouseX: moveCoords.mouseX - startCoords.mouseX,
mouseY: moveCoords.mouseY - startCoords.mouseY
};
}).takeUntil(this.mouseup);
}).takeUntil(merge(this.mouseup, this.mousedown));
}).filter(() => !!currentResize);

mousedrag.map(({mouseX, mouseY}) => {
Expand Down
6 changes: 6 additions & 0 deletions webpack.config.dist.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ module.exports = {
commonjs2: 'rxjs/Observable',
amd: 'rxjs/Observable'
},
'rxjs/observable/merge': {
root: ['rx', 'Observable', 'merge'],
commonjs: 'rxjs/observable/merge',
commonjs2: 'rxjs/observable/merge',
amd: 'rxjs/observable/merge'
},
'rxjs/add/operator/map': {
root: ['rx', 'Observable'],
commonjs: 'rxjs/operator/map',
Expand Down

0 comments on commit c76be59

Please sign in to comment.