2019-03-27 02:20:54 +03:00
|
|
|
function changeTool (selectedTool) {
|
2020-04-04 10:41:56 +03:00
|
|
|
// Ending any selection in progress
|
|
|
|
if (currentTool.includes('select') && !selectedTool.includes('select') && !selectionCanceled) {
|
|
|
|
endSelection();
|
2020-03-05 18:13:23 +03:00
|
|
|
}
|
2019-03-27 02:20:54 +03:00
|
|
|
//set tool and temp tje tje tpp;
|
|
|
|
currentTool = selectedTool;
|
2020-04-04 10:41:56 +03:00
|
|
|
currentToolTemp = selectedTool;
|
|
|
|
|
|
|
|
var tools = document.getElementById('tools-menu').children;
|
|
|
|
|
|
|
|
for (var i = 0; i < tools.length; i++) {
|
|
|
|
tools[i].classList.remove('selected');
|
|
|
|
}
|
|
|
|
|
2019-03-27 02:20:54 +03:00
|
|
|
//give the button of the selected tool the .selected class
|
2020-04-04 10:41:56 +03:00
|
|
|
document.getElementById(selectedTool+'-button').parentNode.classList.add('selected');
|
|
|
|
|
|
|
|
//change cursor
|
|
|
|
updateCursor();
|
|
|
|
}
|