Skip to content

Commit 4a6f97d

Browse files
committed
Removed deprication warnings, Updated docs, Removed bug fix from optional styles
1 parent b377ff6 commit 4a6f97d

File tree

2 files changed

+5
-37
lines changed

2 files changed

+5
-37
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ Here are some properties for your convenience (not all):
128128
|onDragStartBegin |function |OPTIONAL. Fired when the user clicks in the area. This callback gets the event object. Executed **before** DragSelect function code runs |
129129
|onDragStart |function |OPTIONAL. Fired when the user clicks in the area. This callback gets the event object. Executed after DragSelect function code ran, befor the setup of event listeners |
130130
|onDragMove |function |OPTIONAL. Fired when the user drags. This callback gets the event object. Executed before DragSelect function code ran, after getting the current mouse position |
131+
|onDragEnd |function |OPTIONAL. Fired when the user ends drag interaction. This callback gets the event object. Executed after DragSelect function code ran |
131132
|onElementSelect |function |OPTIONAL. Fired every time an element is selected. This callback gets a property which is the selected node |
132133
|onElementUnselect |function |OPTIONAL. Fired every time an element is de-selected. This callback gets a property which is the de-selected node |
133134
|callback |function |OPTIONAL. Callback function that gets fired when the selection is released. This callback gets a property which is an array that holds all selected nodes |

src/DragSelect.js

Lines changed: 4 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ class DragSelect {
7575
*/
7676
constructor({
7777
area = document,
78-
autoScrollSpeed = 1,
78+
autoScrollSpeed = 3,
7979
callback = () => { },
8080
customStyles = false,
8181
hoverClass = 'ds-hover',
@@ -249,11 +249,12 @@ class DragSelect {
249249
var selector = document.createElement('div');
250250

251251
selector.style.position = 'absolute';
252+
selector.style.display = 'none';
253+
selector.style.pointerEvents = 'none'; // fix for issue #8 (ie11+)
254+
252255
if (!this.customStyles) {
253256
selector.style.background = 'rgba(0, 0, 255, 0.1)';
254257
selector.style.border = '1px solid rgba(0, 0, 255, 0.45)';
255-
selector.style.display = 'none';
256-
selector.style.pointerEvents = 'none'; // fix for issue #8 (ie11+)
257258
}
258259

259260
var _area = this.area === document ? document.body : this.area;
@@ -749,15 +750,6 @@ class DragSelect {
749750
* @return {('top'|'bottom'|'left'|'right'|false)}
750751
*/
751752
isCursorNearEdge(area, event) {
752-
// @TODO DEPRECATION: remove support on next major release
753-
if (typeof area === "object" && this._isElement(event)) {
754-
console.warn("[DragSelect] DEPRECATION warning: this method signature is changing. From isCursorNearEdge(event, area) to isCursorNearEdge(area, event). Please use area as first argument and event as second. It will still work for now but functionality be removed soon")
755-
const _event = event
756-
const _area = area
757-
area = _event
758-
event = _area
759-
}
760-
761753
var cursorPosition = this._getCursorPos(area, event);
762754
var areaRect = this._getAreaRect(area);
763755

@@ -1223,18 +1215,6 @@ class DragSelect {
12231215
};
12241216
}
12251217

1226-
/**
1227-
* Returns the current x, y scroll value of a container
1228-
* If container has no scroll it will return 0
1229-
* @param {(HTMLElement|SVGElement)} [area]
1230-
* @return {{x:number,y:number}} scroll X/Y
1231-
* @deprecated
1232-
*/
1233-
getScroll(area) {
1234-
console.warn('[DragSelect]: .getScroll is being deprecated soon. Please do not use it any longer. If you have a real use-case for this, please let us know at https://github.com/ThibaultJanBeyer/DragSelect')
1235-
return this._getScroll(area)
1236-
}
1237-
12381218
/**
12391219
* Returns the current x, y scroll value of a container
12401220
* If container has no scroll it will return 0
@@ -1262,19 +1242,6 @@ class DragSelect {
12621242
return scroll;
12631243
}
12641244

1265-
/**
1266-
* Returns the top/left/bottom/right/width/height
1267-
* values of a node. If Area is document then everything
1268-
* except the sizes will be nulled.
1269-
* @param {HTMLElement|SVGElement|any} area
1270-
* @returns {{top:number,left:number,bottom:number,right:number,width:number,height:number}}
1271-
* @deprecated
1272-
*/
1273-
getAreaRect(area) {
1274-
console.warn('[DragSelect]: .getAreaRect is being deprecated soon. Please do not use it any longer. If you have a real use-case for this, please let us know at https://github.com/ThibaultJanBeyer/DragSelect')
1275-
return this._getAreaRect(area)
1276-
}
1277-
12781245
/**
12791246
* Returns the top/left/bottom/right/width/height
12801247
* values of a node. If Area is document then everything

0 commit comments

Comments
 (0)