mirror of
https://github.com/lospec/pixel-editor.git
synced 2023-08-10 21:12:51 +03:00
22 lines
673 B
JavaScript
22 lines
673 B
JavaScript
function changeTool (selectedTool) {
|
|
// Ending any selection in progress
|
|
if (currentTool.includes('select') && !selectedTool.includes('select') && !selectionCanceled) {
|
|
endSelection();
|
|
}
|
|
//set tool and temp tje tje tpp;
|
|
currentTool = selectedTool;
|
|
currentToolTemp = selectedTool;
|
|
|
|
var tools = document.getElementById('tools-menu').children;
|
|
|
|
for (var i = 0; i < tools.length; i++) {
|
|
tools[i].classList.remove('selected');
|
|
}
|
|
|
|
//give the button of the selected tool the .selected class
|
|
document.getElementById(selectedTool+'-button').parentNode.classList.add('selected');
|
|
|
|
//change cursor
|
|
updateCursor();
|
|
}
|