Skip to content

Commit 24afeab

Browse files
author
Xie, Ziyu
committed
Release v2.0.1
Bugfix for ngDraggable
1 parent a4fae72 commit 24afeab

File tree

5 files changed

+17
-6
lines changed

5 files changed

+17
-6
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ angular2-draggable has angular directives that make the DOM element draggable an
2525
+ provided since v2.0, requires Angular 6
2626

2727
# Latest Update
28+
+ 2018.08.08: 2.0.1
29+
+ Bugfix: click events are blocked. [#87](https://github.com/xieziyu/angular2-draggable/issues/87), [#84](https://github.com/xieziyu/angular2-draggable/issues/84)
30+
2831
+ 2018.08.03: 2.0.0
2932
+ Fix [issue #84](https://github.com/xieziyu/angular2-draggable/issues/84): iFrames, and context unrelated elements block all events, and are unusable
3033

projects/angular2-draggable/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "angular2-draggable",
3-
"version": "2.0.0",
3+
"version": "2.0.1",
44
"peerDependencies": {
55
"@angular/common": "^6.0.0-rc.0 || >=6.0.0",
66
"@angular/core": "^6.0.0-rc.0 || >=6.0.0"

projects/angular2-draggable/src/lib/angular-draggable.directive.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -199,9 +199,6 @@ export class AngularDraggableDirective implements OnInit, OnDestroy, OnChanges {
199199
if (!this.moving) {
200200
this.started.emit(this.el.nativeElement);
201201
this.moving = true;
202-
203-
// Add a transparent helper div:
204-
this._helperBlock.add();
205202
}
206203
}
207204

@@ -357,6 +354,8 @@ export class AngularDraggableDirective implements OnInit, OnDestroy, OnChanges {
357354
event.preventDefault();
358355
}
359356

357+
// Add a transparent helper div:
358+
this._helperBlock.add();
360359
this.moveTo(Position.fromEvent(event));
361360
}
362361
}

projects/angular2-draggable/src/lib/widgets/helper-block.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { Renderer2 } from '@angular/core';
22

33
export class HelperBlock {
44
protected _helper: Element;
5+
private _added = false;
56

67
constructor(
78
protected parent: Element,
@@ -22,19 +23,22 @@ export class HelperBlock {
2223

2324
add() {
2425
// append div to parent
25-
if (this.parent) {
26+
if (this.parent && !this._added) {
2627
this.parent.appendChild(this._helper);
28+
this._added = true;
2729
}
2830
}
2931

3032
remove() {
31-
if (this.parent) {
33+
if (this.parent && this._added) {
3234
this.parent.removeChild(this._helper);
35+
this._added = false;
3336
}
3437
}
3538

3639
dispose() {
3740
this._helper = null;
41+
this._added = false;
3842
}
3943

4044
get el() {

src/assets/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## 2.0.1 (2018-08-08)
2+
3+
#### Bugfix
4+
+ click events are blocked. [#87](https://github.com/xieziyu/angular2-draggable/issues/87), [#84](https://github.com/xieziyu/angular2-draggable/issues/84)
5+
16
## 2.0.0 (2018-08-03)
27

38
#### Bugfix

0 commit comments

Comments
 (0)