2021-07-22 20:26:40 +03:00
|
|
|
// REFACTOR: add to single Tool implementations
|
2019-03-27 02:20:54 +03:00
|
|
|
//pencil
|
2021-07-20 23:52:51 +03:00
|
|
|
Events.on('click',"pencil-button", function(){
|
2020-04-15 03:01:31 +03:00
|
|
|
tool.pencil.switchTo();
|
2019-03-31 13:17:32 +03:00
|
|
|
}, false);
|
2019-03-27 02:20:54 +03:00
|
|
|
|
|
|
|
//pencil bigger
|
2021-07-20 23:52:51 +03:00
|
|
|
Events.on('click',"pencil-bigger-button", function(){
|
2020-04-15 03:01:31 +03:00
|
|
|
tool.pencil.brushSize++;
|
2019-03-31 13:17:32 +03:00
|
|
|
}, false);
|
2019-03-27 02:20:54 +03:00
|
|
|
|
|
|
|
//pencil smaller
|
2021-07-20 23:52:51 +03:00
|
|
|
Events.on('click',"pencil-smaller-button", function(){
|
2020-04-15 03:01:31 +03:00
|
|
|
if(tool.pencil.brushSize > 1)
|
|
|
|
tool.pencil.brushSize--;
|
2019-03-31 13:17:32 +03:00
|
|
|
}, false);
|
|
|
|
|
|
|
|
//eraser
|
2021-07-20 23:52:51 +03:00
|
|
|
Events.on('click',"eraser-button", function(){
|
2020-07-21 15:42:25 +03:00
|
|
|
console.log("selecting eraser");
|
2020-04-15 03:01:31 +03:00
|
|
|
tool.eraser.switchTo();
|
2019-03-31 13:17:32 +03:00
|
|
|
}, false);
|
|
|
|
|
|
|
|
//eraser bigger
|
2021-07-20 23:52:51 +03:00
|
|
|
Events.on('click',"eraser-bigger-button", function(){
|
2020-04-15 03:01:31 +03:00
|
|
|
tool.eraser.brushSize++;
|
2019-03-31 13:17:32 +03:00
|
|
|
}, false);
|
|
|
|
|
|
|
|
//eraser smaller
|
2021-07-20 23:52:51 +03:00
|
|
|
Events.on('click',"eraser-smaller-button", function(e){
|
2020-04-15 03:01:31 +03:00
|
|
|
if(tool.eraser.brushSize > 1)
|
|
|
|
tool.eraser.brushSize--;
|
2019-03-31 13:17:32 +03:00
|
|
|
}, false);
|
2019-03-27 02:20:54 +03:00
|
|
|
|
2020-03-07 01:21:42 +03:00
|
|
|
// rectangle
|
2021-07-20 23:52:51 +03:00
|
|
|
Events.on('click','rectangle-button', function(e){
|
2020-03-07 01:21:42 +03:00
|
|
|
// If the user clicks twice on the button, they change the draw mode
|
2020-04-15 03:01:31 +03:00
|
|
|
if (currentTool.name == 'rectangle') {
|
2021-04-28 23:35:26 +03:00
|
|
|
if (rectangleDrawMode == 'empty') {
|
|
|
|
rectangleDrawMode = 'fill';
|
2020-03-08 00:34:12 +03:00
|
|
|
setRectToolSvg();
|
2020-03-07 01:21:42 +03:00
|
|
|
}
|
|
|
|
else {
|
2021-04-28 23:35:26 +03:00
|
|
|
rectangleDrawMode = 'empty';
|
2020-03-08 00:34:12 +03:00
|
|
|
setRectToolSvg();
|
2020-03-07 01:21:42 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
2020-04-15 03:01:31 +03:00
|
|
|
tool.rectangle.switchTo();
|
2020-03-07 01:21:42 +03:00
|
|
|
}
|
|
|
|
}, false);
|
|
|
|
|
2021-04-28 23:35:26 +03:00
|
|
|
// ellipse
|
2021-07-20 23:52:51 +03:00
|
|
|
Events.on('click','ellipse-button', function(e){
|
2021-04-28 23:35:26 +03:00
|
|
|
// If the user clicks twice on the button, they change the draw mode
|
|
|
|
if (currentTool.name == 'ellipse') {
|
|
|
|
if (ellipseDrawMode == 'empty') {
|
|
|
|
ellipseDrawMode = 'fill';
|
|
|
|
setEllipseToolSvg();
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
ellipseDrawMode = 'empty';
|
|
|
|
setEllipseToolSvg();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
tool.ellipse.switchTo();
|
|
|
|
}
|
|
|
|
}, false);
|
|
|
|
|
2020-03-07 01:21:42 +03:00
|
|
|
// rectangle bigger
|
2021-07-20 23:52:51 +03:00
|
|
|
Events.on('click',"rectangle-bigger-button", function(){
|
2020-04-15 03:01:31 +03:00
|
|
|
tool.rectangle.brushSize++;
|
2020-03-07 01:21:42 +03:00
|
|
|
}, false);
|
|
|
|
|
|
|
|
// rectangle smaller
|
2021-07-20 23:52:51 +03:00
|
|
|
Events.on('click',"rectangle-smaller-button", function(e){
|
2020-04-15 03:01:31 +03:00
|
|
|
if(tool.rectangle.brushSize > 1)
|
|
|
|
tool.rectangle.brushSize--;
|
2020-03-07 01:21:42 +03:00
|
|
|
}, false);
|
|
|
|
|
2021-04-28 23:35:26 +03:00
|
|
|
// ellipse bigger
|
2021-07-20 23:52:51 +03:00
|
|
|
Events.on('click',"ellipse-bigger-button", function(){
|
2021-04-28 23:35:26 +03:00
|
|
|
tool.ellipse.brushSize++;
|
|
|
|
}, false);
|
|
|
|
|
|
|
|
// ellipse smaller
|
2021-07-20 23:52:51 +03:00
|
|
|
Events.on('click',"ellipse-smaller-button", function(e){
|
2021-04-28 23:35:26 +03:00
|
|
|
if(tool.ellipse.brushSize > 1)
|
|
|
|
tool.ellipse.brushSize--;
|
|
|
|
}, false);
|
|
|
|
|
2019-03-27 02:20:54 +03:00
|
|
|
//fill
|
2021-07-20 23:52:51 +03:00
|
|
|
Events.on('click',"fill-button", function(){
|
2020-04-15 03:01:31 +03:00
|
|
|
tool.fill.switchTo();
|
|
|
|
}, false);
|
2019-03-27 02:20:54 +03:00
|
|
|
|
|
|
|
//pan
|
2021-07-20 23:52:51 +03:00
|
|
|
Events.on('click',"pan-button", function(){
|
2020-04-15 03:01:31 +03:00
|
|
|
tool.pan.switchTo();
|
|
|
|
}, false);
|
2019-03-27 02:20:54 +03:00
|
|
|
|
|
|
|
//eyedropper
|
2021-07-20 23:52:51 +03:00
|
|
|
Events.on('click',"eyedropper-button", function(){
|
2020-04-15 03:01:31 +03:00
|
|
|
tool.eyedropper.switchTo();
|
|
|
|
}, false);
|
2019-03-27 02:20:54 +03:00
|
|
|
|
2020-03-04 14:42:15 +03:00
|
|
|
//rectangular selection button
|
2021-07-20 23:52:51 +03:00
|
|
|
Events.on('click', "rectselect-button", function(){
|
2020-04-15 03:01:31 +03:00
|
|
|
tool.rectselect.switchTo();
|
|
|
|
}, false);
|
|
|
|
|
2021-01-14 21:04:39 +03:00
|
|
|
//line
|
2021-07-20 23:52:51 +03:00
|
|
|
Events.on('click',"line-button", function(){
|
2021-01-14 21:04:39 +03:00
|
|
|
tool.line.switchTo();
|
|
|
|
}, false);
|
|
|
|
|
2021-07-20 23:52:51 +03:00
|
|
|
Events.on('click',"line-bigger-button", function(){
|
2021-01-14 23:28:57 +03:00
|
|
|
tool.line.brushSize++;
|
|
|
|
}, false);
|
|
|
|
|
2021-07-20 23:52:51 +03:00
|
|
|
Events.on('click',"line-smaller-button", function(){
|
2021-01-14 23:28:57 +03:00
|
|
|
if(tool.line.brushSize > 1)
|
|
|
|
tool.line.brushSize--;
|
2021-07-12 12:36:30 +03:00
|
|
|
}, false);
|