2019-03-27 02:20:54 +03:00
|
|
|
|
2020-04-15 03:01:31 +03:00
|
|
|
|
2019-03-27 02:20:54 +03:00
|
|
|
//set the correct cursor for the current tool
|
2020-04-15 03:01:31 +03:00
|
|
|
Tool.prototype.updateCursor = function () {
|
2020-04-20 17:55:34 +03:00
|
|
|
//console.log('updateCursor()', currentTool)
|
2020-04-15 03:01:31 +03:00
|
|
|
|
|
|
|
//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) {
|
2020-04-20 17:55:34 +03:00
|
|
|
//console.log('brush size',this.currentBrushSize)
|
2019-03-27 02:20:54 +03:00
|
|
|
brushPreview.style.display = 'block';
|
2020-04-15 03:01:31 +03:00
|
|
|
brushPreview.style.width = this.currentBrushSize * zoom + 'px';
|
|
|
|
brushPreview.style.height = this.currentBrushSize * zoom + 'px';
|
2020-03-07 18:49:01 +03:00
|
|
|
}
|
2020-04-15 03:01:31 +03:00
|
|
|
|
|
|
|
//show / hide eyedropper color preview
|
|
|
|
if (this.eyedropperPreview) eyedropperPreview.style.display = 'block';
|
|
|
|
else eyedropperPreview.style.display = 'none';
|
|
|
|
|
|
|
|
//moveSelection
|
|
|
|
if (currentTool.name == 'moveselection') {
|
2020-03-05 15:34:29 +03:00
|
|
|
if (cursorInSelectedArea()) {
|
2020-03-05 18:13:23 +03:00
|
|
|
canMoveSelection = true;
|
2020-03-05 15:34:29 +03:00
|
|
|
canvasView.style.cursor = 'move';
|
|
|
|
brushPreview.style.display = 'none';
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
canvasView.style.cursor = 'crosshair';
|
|
|
|
}
|
|
|
|
}
|
2020-04-15 03:01:31 +03:00
|
|
|
}
|
|
|
|
|
2020-04-15 03:10:21 +03:00
|
|
|
/*global Tool, dragging, canvasView, brushPreview, canMoveSelection, cursorInSelectedArea, eyedropperPreview, zoom, currentTool */
|