Skip to content

Commit

Permalink
Merge pull request #5 from mapd/ricky/cursor-should-revert-when-shape…
Browse files Browse the repository at this point in the history
…s-are-deleted

Added default cursor logic to delete methods
  • Loading branch information
duhoang authored Apr 20, 2017
2 parents c6647f2 + c71d88b commit 83e5aa1
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 12 deletions.
2 changes: 1 addition & 1 deletion dist/mapd-draw-dev.js

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions dist/mapd-draw.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/mapd-draw.js.map

Large diffs are not rendered by default.

27 changes: 21 additions & 6 deletions src/engine/shape-builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -371,10 +371,10 @@ export default class ShapeBuilder extends DrawEngine {
this._parent.style.cursor = 'none'
// forEach not supported on nodelist in IE/Edge
for (let i = 0; i < this._parent.childNodes.length; i++) {
this._parent.childNodes[i].style.cursor = 'none'
if(this._parent.childNodes[i].nodeName.toLowerCase() === 'canvas') {
continue
}
this._parent.childNodes[i].style.cursor = 'none'
this._parent.childNodes[i].style.pointerEvents = 'none'
}
if (selectedShape && (hitInfo = selectedShape.containsPoint(tmpPt1, tmpPt2, worldToScreenMatrix, this._drawCtx)).hit) {
Expand Down Expand Up @@ -417,10 +417,10 @@ export default class ShapeBuilder extends DrawEngine {
this._parent.style.cursor = 'none'
// forEach not supported on nodelist in IE/Edge
for (let i = 0; i < this._parent.childNodes.length; i++) {
this._parent.childNodes[i].style.cursor = 'none'
if(this._parent.childNodes[i].nodeName.toLowerCase() === 'canvas') {
continue
}
this._parent.childNodes[i].style.cursor = 'none'
this._parent.childNodes[i].style.pointerEvents = 'none'
}
if (hitInfo.controlIndex >= shapes[i].numVerts) {
Expand All @@ -442,9 +442,6 @@ export default class ShapeBuilder extends DrawEngine {
}
this._parent.style.cursor = "move"
for (let i = 0; i < this._parent.childNodes.length; i++) {
if(this._parent.childNodes[i].nodeName.toLowerCase() === 'canvas') {
continue
}
this._parent.childNodes[i].style.cursor = 'move'
}
event.stopImmediatePropagation()
Expand All @@ -460,10 +457,10 @@ export default class ShapeBuilder extends DrawEngine {
this._parent.style.cursor = "default"
// forEach not supported on nodelist in IE/Edge
for (let i = 0; i < this._parent.childNodes.length; i++) {
this._parent.childNodes[i].style.cursor = 'default'
if(this._parent.childNodes[i].nodeName.toLowerCase() === 'canvas') {
continue
}
this._parent.childNodes[i].style.cursor = 'default'
this._parent.childNodes[i].style.pointerEvents = 'auto'
}
}
Expand Down Expand Up @@ -670,6 +667,15 @@ export default class ShapeBuilder extends DrawEngine {
unselectedShapes: selectClearedShapes,
selectedShapes: getSelectedObjsFromMap(this._selectedShapes)
})

removeCustomCursor()
this._parent.style.cursor = "default"
// forEach not supported on nodelist in IE/Edge
for (let i = 0; i < this._parent.childNodes.length; i++) {
this._parent.childNodes[i].style.cursor = 'default'
this._parent.childNodes[i].style.pointerEvents = 'auto'
}

return super.deleteShape(shapes)
}

Expand All @@ -680,6 +686,15 @@ export default class ShapeBuilder extends DrawEngine {
unselectedShapes: selectedShapes,
selectedShapes: []
})

removeCustomCursor()
this._parent.style.cursor = "default"
// forEach not supported on nodelist in IE/Edge
for (let i = 0; i < this._parent.childNodes.length; i++) {
this._parent.childNodes[i].style.cursor = 'default'
this._parent.childNodes[i].style.pointerEvents = 'auto'
}

return super.deleteShape(selectedShapes)
}

Expand Down

0 comments on commit 83e5aa1

Please sign in to comment.