Skip to content

Commit 707c335

Browse files
author
Xie, Ziyu
authored
Merge pull request #99 from xieziyu/dev
Release v2.1.2
2 parents 50fe3a4 + 7610a6d commit 707c335

File tree

4 files changed

+58
-55
lines changed

4 files changed

+58
-55
lines changed

README.md

Lines changed: 18 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
# angular2-draggable
2-
[![npm version](https://badge.fury.io/js/angular2-draggable.svg)](http://badge.fury.io/js/angular2-draggable)
3-
[![npm downloads](https://img.shields.io/npm/dm/angular2-draggable.svg)](https://npmjs.org/angular2-draggable)
4-
[![Build Status](https://travis-ci.org/xieziyu/angular2-draggable.svg?branch=master)](https://travis-ci.org/xieziyu/angular2-draggable)
2+
3+
<!-- Badges section here. -->
4+
[![npm](https://img.shields.io/npm/v/angular2-draggable.svg)][npm-badge-url]
5+
[![npm](https://img.shields.io/npm/dm/angular2-draggable.svg)][npm-badge-url]
6+
[![Build Status](https://travis-ci.org/xieziyu/angular2-draggable.svg?branch=master)][ci-url]
57

68
+ [Online Demo](https://xieziyu.github.io/angular2-draggable)
79
+ [Online Docs](https://xieziyu.github.io/angular2-draggable/api-doc)
@@ -25,9 +27,12 @@ angular2-draggable has angular directives that make the DOM element draggable an
2527
+ provided since v2.0, requires Angular >= 6
2628

2729
# Latest Update
30+
+ 2018.08.20: 2.1.2
31+
+ **ngDraggable**: fix [issue #97](https://github.com/xieziyu/angular2-draggable/issues/97): Item is produced with div partially out of bounds.
32+
2833
+ 2018.08.14: 2.1.1
29-
+ ngResizable: Provide `[rzGrid]`. Snaps the resizing element to a grid.
30-
+ ngResizable: Provide `[rzMinWidth]`, `[rzMaxWidth]`, `[rzMinHeight]`, `[rzMaxHeight]`. The minimum/maximum width/height the resizable should be allowed to resize to.
34+
+ **ngResizable**: Provide `[rzGrid]`. Snaps the resizing element to a grid.
35+
+ **ngResizable**: Provide `[rzMinWidth]`, `[rzMaxWidth]`, `[rzMinHeight]`, `[rzMaxHeight]`. The minimum/maximum width/height the resizable should be allowed to resize to.
3136
+ Bugfix: resizing from w, nw or n with a min/max size moves the window if it goes below/above the min/max size. [#94](https://github.com/xieziyu/angular2-draggable/issues/94)
3237

3338
+ 2018.08.08: 2.0.1
@@ -37,52 +42,16 @@ angular2-draggable has angular directives that make the DOM element draggable an
3742
+ Fix [issue #84](https://github.com/xieziyu/angular2-draggable/issues/84): iFrames, and context unrelated elements block all events, and are unusable
3843

3944
+ 2018.07.02: 2.0.0-beta.2
40-
+ ngResizable: Provide `[rzAspectRatio]`, whether the element should be constrained to a specific aspect ratio. [demo](https://xieziyu.github.io/angular2-draggable/#/resizable/aspect-ratio)
41-
+ ngResizable: Provide `[rzContainment]`, constrains resizing to within the bounds of the specified element or region. [demo](https://xieziyu.github.io/angular2-draggable/#/resizable/containment)
45+
+ **ngResizable**: Provide `[rzAspectRatio]`, whether the element should be constrained to a specific aspect ratio. [demo](https://xieziyu.github.io/angular2-draggable/#/resizable/aspect-ratio)
46+
+ **ngResizable**: Provide `[rzContainment]`, constrains resizing to within the bounds of the specified element or region. [demo](https://xieziyu.github.io/angular2-draggable/#/resizable/containment)
4247

4348
+ 2018.06.26: 2.0.0-beta.1
44-
+ ngResizable: Provide `(rzStart)`, `(rzResizing)`, `(rzStop)` event emitters
45-
+ ngResizable: Provide `resetSize()`, `getStatus()` methods
49+
+ **ngResizable**: Provide `(rzStart)`, `(rzResizing)`, `(rzStop)` event emitters
50+
+ **ngResizable**: Provide `resetSize()`, `getStatus()` methods
4651

4752
+ 2018.06.25: 2.0.0-beta.0
4853
+ New: `ngResizable` directive which you can use to make the element resizable! More resizable options are planning. Refer to [demo](https://xieziyu.github.io/angular2-draggable/#/resizable/default)
4954

50-
+ 2018.05.23: 1.4.2
51-
+ Changes: expose boundsCheck() method.
52-
53-
+ 2018.05.11: 1.4.1
54-
+ Bugfix: Handle Drag is not working in Firefox [#68](https://github.com/xieziyu/angular2-draggable/issues/68).
55-
56-
+ 2018.05.04: 1.4.0
57-
+ Provide `[gridSize]` option for snapping to grid. Refer to [demo](https://xieziyu.github.io/angular2-draggable/#/advance/snap-grid). (PR [#64](https://github.com/xieziyu/angular2-draggable/pull/64) by [PAHADIx](https://github.com/PAHADIx))
58-
+ Code optimized. (PR [#60](https://github.com/xieziyu/angular2-draggable/pull/60) by [korn3l](https://github.com/korn3l))
59-
60-
+ 2018.04.10: 1.3.2
61-
+ Provide `[outOfBounds]` option. Set it to allow element get out of bounds from the direction. Refer to [demo](https://xieziyu.github.io/angular2-draggable/#/usage/boundary). (PR [#57](https://github.com/xieziyu/angular2-draggable/issues/58) by [waldo2188](https://github.com/waldo2188))
62-
63-
+ 2018.03.15: 1.3.1
64-
+ Provide `(movingOffset)` event emitter: emit position offset when moving
65-
+ Provide `(endOffset)` event emitter: emit position offset when stop moving
66-
67-
+ 2018.03.09: 1.3.0
68-
+ Provide `[position]` option: to set current position offset.
69-
70-
+ 2018.02.08: 1.2.1
71-
+ Bugfix: `[preventDefaultEvent]` should not prevent events of elements outside the handle.
72-
73-
+ 2018.02.07: 1.2.0
74-
+ **BREAKING CHANGE**: use `Renderer2` of angular-core. So we don't support angular version < 4.0.
75-
+ Provide: `resetPosition()` method to reset position. Refer to [demo](https://xieziyu.github.io/angular2-draggable/#/usage/api) for details.
76-
+ Bugfix: `[trackPosition]` was not working as expected.
77-
+ Change: The directive now `exportAs: 'ngDraggable'`. For example we can use `<div ngDraggable #block="ngDraggable"></div>` to assign this directive to a variable.
78-
+ Change: `[preventDefaultEvent]` set default to false.
79-
80-
+ 2018.02.01: 1.1.0
81-
82-
+ Provide `[trackPosition]` option: whether to track the element's movement. (PR by [Blackbaud-MikitaYankouski](https://github.com/Blackbaud-MikitaYankouski))
83-
+ Provide `[scale]` option: to fix scaling issue [#31](https://github.com/xieziyu/angular2-draggable/issues/31)
84-
+ Provide `[preventDefaultEvent]` option: whether to prevent default mouse or touch event. (default: true)
85-
8655
# Installation
8756
```
8857
npm install angular2-draggable --save
@@ -257,3 +226,7 @@ yarn install
257226
yarn demo
258227
```
259228
The demo page server is listening to: http://localhost:4203
229+
230+
231+
[npm-badge-url]: https://www.npmjs.com/package/angular2-draggable
232+
[ci-url]: https://travis-ci.org/xieziyu/angular2-draggable

projects/angular2-draggable/package.json

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,22 @@
11
{
22
"name": "angular2-draggable",
3-
"version": "2.1.1",
3+
"version": "2.1.2",
4+
"author": "Xie, Ziyu",
45
"license": "MIT",
6+
"keywords": [
7+
"angular",
8+
"ng",
9+
"drag",
10+
"resize",
11+
"draggable",
12+
"resizable"
13+
],
14+
"repository": {
15+
"type" : "git",
16+
"url" : "https://github.com/xieziyu/angular2-draggable.git"
17+
},
18+
"homepage": "https://xieziyu.github.io/angular2-draggable",
19+
"bugs": "https://github.com/xieziyu/angular2-draggable/issues",
520
"peerDependencies": {
621
"@angular/common": "^6.0.0-rc.0 || >=6.0.0",
722
"@angular/core": "^6.0.0-rc.0 || >=6.0.0"

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

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import {
22
Directive, ElementRef, Renderer2,
33
Input, Output, OnInit, HostListener,
4-
EventEmitter, OnChanges, SimpleChanges, OnDestroy
4+
EventEmitter, OnChanges, SimpleChanges, OnDestroy, AfterViewInit
55
} from '@angular/core';
66

77
import { IPosition, Position } from './models/position';
@@ -11,7 +11,7 @@ import { HelperBlock } from './widgets/helper-block';
1111
selector: '[ngDraggable]',
1212
exportAs: 'ngDraggable'
1313
})
14-
export class AngularDraggableDirective implements OnInit, OnDestroy, OnChanges {
14+
export class AngularDraggableDirective implements OnInit, OnDestroy, OnChanges, AfterViewInit {
1515
private allowDrag = true;
1616
private moving = false;
1717
private orignal: Position = null;
@@ -133,6 +133,14 @@ export class AngularDraggableDirective implements OnInit, OnDestroy, OnChanges {
133133
}
134134
}
135135

136+
ngAfterViewInit() {
137+
if (this.inBounds) {
138+
this.boundsCheck();
139+
this.oldTrans.add(this.tempTrans);
140+
this.tempTrans.reset();
141+
}
142+
}
143+
136144
resetPosition() {
137145
if (Position.isIPosition(this.position)) {
138146
this.oldTrans.set(this.position);

src/assets/CHANGELOG.md

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,18 @@
1+
## 2.1.2 (2018-08-20)
2+
3+
#### Bugfix
4+
+ **ngDraggable**: Item is produced with div partially out of bounds. [#97](https://github.com/xieziyu/angular2-draggable/issues/97)
5+
6+
---
7+
18
## 2.1.1 (2018-08-14)
29

310
#### New
4-
+ ngResizable: Provide `[rzGrid]`. Snaps the resizing element to a grid.
5-
+ ngResizable: Provide `[rzMinWidth]`, `[rzMaxWidth]`, `[rzMinHeight]`, `[rzMaxHeight]`. The minimum/maximum width/height the resizable should be allowed to resize to.
11+
+ **ngResizable**: Provide `[rzGrid]`. Snaps the resizing element to a grid.
12+
+ **ngResizable**: Provide `[rzMinWidth]`, `[rzMaxWidth]`, `[rzMinHeight]`, `[rzMaxHeight]`. The minimum/maximum width/height the resizable should be allowed to resize to.
613

714
#### Bugfix
8-
+ ngResizable: resizing from w, nw or n with a min/max size moves the window if it goes below/above the min/max size. [#94](https://github.com/xieziyu/angular2-draggable/issues/94)
15+
+ **ngResizable**: resizing from w, nw or n with a min/max size moves the window if it goes below/above the min/max size. [#94](https://github.com/xieziyu/angular2-draggable/issues/94)
916

1017
---
1118

@@ -26,16 +33,16 @@
2633
## 2.0.0-beta.2 (2018-07-02)
2734

2835
#### New
29-
+ ngResizable: Provide `[rzAspectRatio]`, whether the element should be constrained to a specific aspect ratio.
30-
+ ngResizable: Provide `[rzContainment]`, constrains resizing to within the bounds of the specified element or region.
36+
+ **ngResizable**: Provide `[rzAspectRatio]`, whether the element should be constrained to a specific aspect ratio.
37+
+ **ngResizable**: Provide `[rzContainment]`, constrains resizing to within the bounds of the specified element or region.
3138

3239
---
3340

3441
## 2.0.0-beta.1 (2018-06-26)
3542

3643
#### New
37-
+ ngResizable: Provide `(rzStart)`, `(rzResizing)`, `(rzStop)` event emitters
38-
+ ngResizable: Provide `resetSize()`, `getStatus()` methods
44+
+ **ngResizable**: Provide `(rzStart)`, `(rzResizing)`, `(rzStop)` event emitters
45+
+ **ngResizable**: Provide `resetSize()`, `getStatus()` methods
3946

4047
---
4148

0 commit comments

Comments
 (0)