mirror of
https://github.com/lospec/pixel-editor.git
synced 2023-08-10 21:12:51 +03:00
Fixed selection tools dragging when the cursor is not in the selection
This commit is contained in:
parent
cdabbb4a5c
commit
c5ede4cc69
@ -1,6 +1,3 @@
|
|||||||
/** TODO
|
|
||||||
* - Increase the sensibility of the tool depending on the width / height ratio to avoid holes
|
|
||||||
*/
|
|
||||||
class EllipseTool extends ResizableTool {
|
class EllipseTool extends ResizableTool {
|
||||||
// Saving the empty rect svg
|
// Saving the empty rect svg
|
||||||
emptyEllipseSVG = document.getElementById("ellipse-empty-button-svg");
|
emptyEllipseSVG = document.getElementById("ellipse-empty-button-svg");
|
||||||
|
@ -1,6 +1,3 @@
|
|||||||
/** TODO
|
|
||||||
* - Move the selection only if the user started dragging inside of it
|
|
||||||
*/
|
|
||||||
class LassoSelectionTool extends SelectionTool {
|
class LassoSelectionTool extends SelectionTool {
|
||||||
currentPixels = [];
|
currentPixels = [];
|
||||||
|
|
||||||
|
@ -75,6 +75,9 @@ class MoveSelectionTool extends DrawingTool {
|
|||||||
|
|
||||||
onDrag(mousePos) {
|
onDrag(mousePos) {
|
||||||
super.onDrag(mousePos);
|
super.onDrag(mousePos);
|
||||||
|
|
||||||
|
if (!this.selectionTool.cursorInSelectedArea(mousePos))
|
||||||
|
return;
|
||||||
|
|
||||||
this.selectionTool.moveOffset =
|
this.selectionTool.moveOffset =
|
||||||
[Math.floor(mousePos[0] / currFile.zoom - currFile.canvasSize[0] / 2 - (this.selectionTool.boundingBoxCenter[0] - currFile.canvasSize[0]/2)),
|
[Math.floor(mousePos[0] / currFile.zoom - currFile.canvasSize[0] / 2 - (this.selectionTool.boundingBoxCenter[0] - currFile.canvasSize[0]/2)),
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
// TODO: FIX SELECTION
|
|
||||||
|
|
||||||
class RectangleTool extends ResizableTool {
|
class RectangleTool extends ResizableTool {
|
||||||
// Saving the empty rect svg
|
// Saving the empty rect svg
|
||||||
emptyRectangleSVG = document.getElementById("rectangle-empty-button-svg");
|
emptyRectangleSVG = document.getElementById("rectangle-empty-button-svg");
|
||||||
|
@ -47,6 +47,7 @@ class ResizableTool extends DrawingTool {
|
|||||||
//fix offset so the cursor stays centered
|
//fix offset so the cursor stays centered
|
||||||
this.updateCursor();
|
this.updateCursor();
|
||||||
this.onHover(this.startResizePos, mouseEvent);
|
this.onHover(this.startResizePos, mouseEvent);
|
||||||
|
TopMenuModule.updateField(this.name + "-input", this.currSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
onRightEnd(mousePos, mouseEvent) {
|
onRightEnd(mousePos, mouseEvent) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user