mirror of
https://github.com/piskelapp/piskel.git
synced 2023-08-10 21:12:52 +03:00
Enhancement : shape tool + shift : now constrained to minimum
This commit is contained in:
@@ -74,14 +74,16 @@
|
|||||||
* @return {Object} {row : Number, col : Number}
|
* @return {Object} {row : Number, col : Number}
|
||||||
*/
|
*/
|
||||||
ns.ShapeTool.prototype.getScaledCoordinates_ = function(col, row) {
|
ns.ShapeTool.prototype.getScaledCoordinates_ = function(col, row) {
|
||||||
var sign;
|
var dX = this.startCol - col;
|
||||||
if (Math.abs(this.startCol - col) > Math.abs(this.startRow - row)) {
|
var absX = Math.abs(dX);
|
||||||
sign = row > this.startRow ? 1 : -1;
|
|
||||||
row = this.startRow + (sign * Math.abs(this.startCol - col));
|
var dY = this.startRow - row;
|
||||||
} else {
|
var absY = Math.abs(dY);
|
||||||
sign = col > this.startCol ? 1 : -1;
|
|
||||||
col = this.startCol + (sign * Math.abs(this.startRow - row));
|
var delta = Math.min(absX, absY);
|
||||||
}
|
row = this.startRow - ((dY/absY)*delta);
|
||||||
|
col = this.startCol - ((dX/absX)*delta);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
col : col,
|
col : col,
|
||||||
row : row
|
row : row
|
||||||
|
Reference in New Issue
Block a user