Skip to content
This repository was archived by the owner on Aug 25, 2022. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion plugins/file/wPaint.menu.main.file.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added plugins/main/img/icons-arrow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions plugins/main/src/wPaint.menu.main.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,13 @@
index: 5,
callback: function () { this.setMode('line'); }
},
arrow: {
icon: 'activate',
img: 'plugins/main/img/icons-arrow.png',
index: 0,
title: 'Arrow',
callback: function () { this.setMode('arrow'); }
},
pencil: {
icon: 'activate',
title: 'Pencil',
Expand Down
3 changes: 2 additions & 1 deletion plugins/main/wPaint.menu.main.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

39 changes: 39 additions & 0 deletions plugins/shapes/src/wPaint.menu.main.shapes.js
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,45 @@
_drawHexagonUp: function (e) {
this._drawShapeUp(e);
this._addUndo();
},

/****************************************
* arrow
****************************************/
_drawArrowDown: function (e) { this._drawShapeDown(e); },

_drawArrowMove: function (e) {
this._drawShapeMove(e);

var xo = this.canvasTempLeftOriginal;
var yo = this.canvasTempTopOriginal;

if (e.pageX < xo) { e.x = e.x + e.w; e.w = e.w * - 1; }
if (e.pageY < yo) { e.y = e.y + e.h; e.h = e.h * - 1; }

var lx = e.x + e.w;
var ly = e.y + e.h;

var angle = Math.atan2(e.h, e.w);

this.ctxTemp.beginPath();
this.ctxTemp.moveTo(e.x, e.y);
this.ctxTemp.lineTo(lx, ly);
this.ctxTemp.stroke();

this.ctxTemp.beginPath();
this.ctxTemp.moveTo(lx, ly);
this.ctxTemp.lineTo(lx - 10 * Math.cos(angle - Math.PI / 7), ly - 10 * Math.sin(angle - Math.PI / 7));
this.ctxTemp.lineTo(lx - 10 * Math.cos(angle + Math.PI / 7), ly - 10 * Math.sin(angle + Math.PI / 7));
this.ctxTemp.lineTo(lx, ly);
this.ctxTemp.lineTo(lx - 10 * Math.cos(angle - Math.PI / 7), ly - 10 * Math.sin(angle - Math.PI / 7));
this.ctxTemp.closePath();
this.ctxTemp.stroke();
},

_drawArrowUp: function (e) {
this._drawShapeUp(e);
this._addUndo();
}
});
})(jQuery);
Loading