2019-03-27 02:20:54 +03:00
|
|
|
//pencil
|
|
|
|
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
|
|
|
|
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
|
2019-03-31 13:17:32 +03:00
|
|
|
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
|
|
|
|
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
|
|
|
|
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
|
|
|
|
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
|
2020-07-21 15:42:25 +03:00
|
|
|
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
|
|
|
|
on('click','ellipse-button', function(e){
|
|
|
|
// 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
|
|
|
|
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
|
|
|
|
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
|
|
|
|
on('click',"ellipse-bigger-button", function(){
|
|
|
|
tool.ellipse.brushSize++;
|
|
|
|
}, false);
|
|
|
|
|
|
|
|
// ellipse smaller
|
|
|
|
on('click',"ellipse-smaller-button", function(e){
|
|
|
|
if(tool.ellipse.brushSize > 1)
|
|
|
|
tool.ellipse.brushSize--;
|
|
|
|
}, false);
|
|
|
|
|
2019-03-27 02:20:54 +03:00
|
|
|
//fill
|
|
|
|
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
|
|
|
|
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
|
|
|
|
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
|
|
|
|
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
|
|
|
|
on('click',"line-button", function(){
|
|
|
|
tool.line.switchTo();
|
|
|
|
}, false);
|
|
|
|
|
2021-01-14 23:28:57 +03:00
|
|
|
on('click',"line-bigger-button", function(){
|
|
|
|
tool.line.brushSize++;
|
|
|
|
}, false);
|
|
|
|
|
|
|
|
on('click',"line-smaller-button", function(){
|
|
|
|
if(tool.line.brushSize > 1)
|
|
|
|
tool.line.brushSize--;
|
|
|
|
}, false);
|
|
|
|
|
|
|
|
|
2020-04-15 03:10:21 +03:00
|
|
|
/*global on */
|