fix shift draw with line tool

This commit is contained in:
raphael 2020-04-03 15:07:05 +02:00
parent 707e8eacbb
commit 2f637671c3

View File

@ -172,7 +172,7 @@ var whiteboard = {
if (_this.tool === "line") { if (_this.tool === "line") {
if (_this.pressedKeys.shift) { if (_this.pressedKeys.shift) {
var angs = getRoundedAngles(currX, currY); var angs = _this.getRoundedAngles(currX, currY);
currX = angs.x; currX = angs.x;
currY = angs.y; currY = angs.y;
} }
@ -266,8 +266,9 @@ var whiteboard = {
_this.sendFunction({ "t": "addTextBox", "d": [_this.drawcolor, fontsize, currX, currY, txId] }); _this.sendFunction({ "t": "addTextBox", "d": [_this.drawcolor, fontsize, currX, currY, txId] });
_this.addTextBox(_this.drawcolor, fontsize, currX, currY, txId, true); _this.addTextBox(_this.drawcolor, fontsize, currX, currY, txId, true);
}); });
},
function getRoundedAngles(currX, currY) { //For drawing lines at 0,45,90° .... getRoundedAngles: function (currX, currY) { //For drawing lines at 0,45,90° ....
var _this = this;
var x = currX - _this.startCoords[0]; var x = currX - _this.startCoords[0];
var y = currY - _this.startCoords[1]; var y = currY - _this.startCoords[1];
var angle = Math.atan2(x, y) * (180 / Math.PI); var angle = Math.atan2(x, y) * (180 / Math.PI);
@ -286,7 +287,6 @@ var whiteboard = {
} }
} }
return { "x": currX, "y": currY }; return { "x": currX, "y": currY };
}
}, },
triggerMouseMove: function (e) { triggerMouseMove: function (e) {
var _this = this; var _this = this;
@ -324,7 +324,7 @@ var whiteboard = {
} else if (_this.tool === "line") { } else if (_this.tool === "line") {
if (_this.svgLine) { if (_this.svgLine) {
if (_this.pressedKeys.shift) { if (_this.pressedKeys.shift) {
var angs = getRoundedAngles(currX, currY); var angs = _this.getRoundedAngles(currX, currY);
currX = angs.x; currX = angs.x;
currY = angs.y; currY = angs.y;
} }