Skip to content

Commit

Permalink
Removed deprication warnings, Updated docs, Removed bug fix from opti…
Browse files Browse the repository at this point in the history
…onal styles
  • Loading branch information
owenfar committed Jan 10, 2023
1 parent b377ff6 commit 4a6f97d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 37 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ Here are some properties for your convenience (not all):
|onDragStartBegin |function |OPTIONAL. Fired when the user clicks in the area. This callback gets the event object. Executed **before** DragSelect function code runs |
|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 |
|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 |
|onDragEnd |function |OPTIONAL. Fired when the user ends drag interaction. This callback gets the event object. Executed after DragSelect function code ran |
|onElementSelect |function |OPTIONAL. Fired every time an element is selected. This callback gets a property which is the selected node |
|onElementUnselect |function |OPTIONAL. Fired every time an element is de-selected. This callback gets a property which is the de-selected node |
|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 |
Expand Down
41 changes: 4 additions & 37 deletions src/DragSelect.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class DragSelect {
*/
constructor({
area = document,
autoScrollSpeed = 1,
autoScrollSpeed = 3,
callback = () => { },
customStyles = false,
hoverClass = 'ds-hover',
Expand Down Expand Up @@ -249,11 +249,12 @@ class DragSelect {
var selector = document.createElement('div');

selector.style.position = 'absolute';
selector.style.display = 'none';
selector.style.pointerEvents = 'none'; // fix for issue #8 (ie11+)

if (!this.customStyles) {
selector.style.background = 'rgba(0, 0, 255, 0.1)';
selector.style.border = '1px solid rgba(0, 0, 255, 0.45)';
selector.style.display = 'none';
selector.style.pointerEvents = 'none'; // fix for issue #8 (ie11+)
}

var _area = this.area === document ? document.body : this.area;
Expand Down Expand Up @@ -749,15 +750,6 @@ class DragSelect {
* @return {('top'|'bottom'|'left'|'right'|false)}
*/
isCursorNearEdge(area, event) {
// @TODO DEPRECATION: remove support on next major release
if (typeof area === "object" && this._isElement(event)) {
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")
const _event = event
const _area = area
area = _event
event = _area
}

var cursorPosition = this._getCursorPos(area, event);
var areaRect = this._getAreaRect(area);

Expand Down Expand Up @@ -1223,18 +1215,6 @@ class DragSelect {
};
}

/**
* Returns the current x, y scroll value of a container
* If container has no scroll it will return 0
* @param {(HTMLElement|SVGElement)} [area]
* @return {{x:number,y:number}} scroll X/Y
* @deprecated
*/
getScroll(area) {
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')
return this._getScroll(area)
}

/**
* Returns the current x, y scroll value of a container
* If container has no scroll it will return 0
Expand Down Expand Up @@ -1262,19 +1242,6 @@ class DragSelect {
return scroll;
}

/**
* Returns the top/left/bottom/right/width/height
* values of a node. If Area is document then everything
* except the sizes will be nulled.
* @param {HTMLElement|SVGElement|any} area
* @returns {{top:number,left:number,bottom:number,right:number,width:number,height:number}}
* @deprecated
*/
getAreaRect(area) {
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')
return this._getAreaRect(area)
}

/**
* Returns the top/left/bottom/right/width/height
* values of a node. If Area is document then everything
Expand Down

0 comments on commit 4a6f97d

Please sign in to comment.