Skip to content

Commit c0ff88f

Browse files
updating readme with last changes
1 parent d680428 commit c0ff88f

File tree

1 file changed

+23
-7
lines changed

1 file changed

+23
-7
lines changed

README.md

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,8 @@ For example in `v-draggable="draggableValue"` draggableValue can be an object co
8383
* [initialPosition](#initialPosition)
8484
* [stopDragging](#stopdragging)
8585
* [boundingRect](#boundingrect)
86-
87-
86+
* [boundingElement](#boundingElement)
87+
* [boundingRectMargin](#boundingRectMargin)
8888
#### handle
8989
Type: `HtmlElement | Vue`<br>
9090
Required: `false`<br>
@@ -99,8 +99,7 @@ Type: `Function`<br>
9999
Required: `false`<br>
100100
101101
In some cases it is useful to know the coordinates of the element when it's been dragged.<br>
102-
Passing a callback to `draggableValue` will achieve this goal and every time the element is being dragged the callback
103-
will be executed with the current position as param.<br>
102+
Passing a callback to `draggableValue` will achieve this goal and every time the element is being dragged the callback will be executed with 3 params: positionDiff, absolutePosition, event.<br>
104103
105104
``` js
106105
import { Draggable } from 'draggable-vue-directive'
@@ -117,9 +116,9 @@ will be executed with the current position as param.<br>
117116
}
118117
},
119118
methods: {
120-
onPosChanged: function(pos) {
121-
console.log("left corner", pos.x);
122-
console.log("top corner", pos.y);
119+
onPosChanged: function(positionDiff, absolutePosition, event) {
120+
console.log("left corner", absolutePosition.left);
121+
console.log("top corner", absolutePosition.top);
123122
}
124123
}
125124
...
@@ -155,3 +154,20 @@ Required: `false`<br>
155154
default: `undefined`<br>
156155
157156
Constrains dragging to within the bounds of the rectangle.
157+
158+
159+
#### boundingElement
160+
Type: `HtmlElement`<br>
161+
Required: `false`<br>
162+
default: `undefined`<br>
163+
164+
Constrains dragging to within the bounds of the element.
165+
166+
167+
#### boundingRectMargin
168+
Type: `MarginOptions`<br>
169+
Required: `false`<br>
170+
default: `undefined`<br>
171+
172+
When using boundingRect or boundingElement, you can pass an object with top, left, bottom, right
173+
properties, to define a margin between the elements and the boundries.

0 commit comments

Comments
 (0)