pixel-editor/js/_updateCursor.js

36 lines
1.1 KiB
JavaScript
Raw Normal View History

2019-03-27 02:20:54 +03:00
2019-03-27 02:20:54 +03:00
//set the correct cursor for the current tool
Tool.prototype.updateCursor = function () {
//console.log('updateCursor()', currentTool)
//switch to that tools cursor
canvasView.style.cursor = this.cursor || 'default';
//if the tool uses a brush preview, make it visible and update the size
if (this.brushPreview) {
//console.log('brush size',this.currentBrushSize)
2019-03-27 02:20:54 +03:00
brushPreview.style.display = 'block';
brushPreview.style.width = this.currentBrushSize * zoom + 'px';
brushPreview.style.height = this.currentBrushSize * zoom + 'px';
2020-03-07 18:49:01 +03:00
}
//show / hide eyedropper color preview
if (this.eyedropperPreview) eyedropperPreview.style.display = 'block';
else eyedropperPreview.style.display = 'none';
//moveSelection
if (currentTool.name == 'moveselection') {
if (cursorInSelectedArea()) {
2020-03-05 18:13:23 +03:00
canMoveSelection = true;
canvasView.style.cursor = 'move';
brushPreview.style.display = 'none';
}
else {
canvasView.style.cursor = 'crosshair';
}
}
}
2020-04-15 03:10:21 +03:00
/*global Tool, dragging, canvasView, brushPreview, canMoveSelection, cursorInSelectedArea, eyedropperPreview, zoom, currentTool */