mirror of
https://github.com/scratchfoundation/scratch-paint.git
synced 2025-01-10 06:32:07 -05:00
commit
46ff0bd3e1
3 changed files with 7 additions and 4 deletions
|
@ -70,6 +70,7 @@ class BoundingBoxTool {
|
|||
* @return {boolean} True if there was a hit, false otherwise
|
||||
*/
|
||||
onMouseDown (event, clone, multiselect, hitOptions) {
|
||||
if (event.event.button > 0) return; // only first mouse button
|
||||
const hitResults = paper.project.hitTestAll(event.point, hitOptions);
|
||||
if (!hitResults || hitResults.length === 0) {
|
||||
if (!multiselect) {
|
||||
|
@ -113,11 +114,11 @@ class BoundingBoxTool {
|
|||
return true;
|
||||
}
|
||||
onMouseDrag (event) {
|
||||
if (event.event.button > 0) return; // only first mouse button
|
||||
if (event.event.button > 0 || !this.mode) return; // only first mouse button
|
||||
this._modeMap[this.mode].onMouseDrag(event);
|
||||
}
|
||||
onMouseUp (event) {
|
||||
if (event.event.button > 0) return; // only first mouse button
|
||||
if (event.event.button > 0 || !this.mode) return; // only first mouse button
|
||||
this._modeMap[this.mode].onMouseUp(event);
|
||||
|
||||
this.mode = null;
|
||||
|
|
|
@ -217,11 +217,11 @@ class ReshapeTool extends paper.Tool {
|
|||
}
|
||||
}
|
||||
handleMouseDrag (event) {
|
||||
if (event.event.button > 0) return; // only first mouse button
|
||||
if (event.event.button > 0 || !this.mode) return; // only first mouse button
|
||||
this._modeMap[this.mode].onMouseDrag(event);
|
||||
}
|
||||
handleMouseUp (event) {
|
||||
if (event.event.button > 0) return; // only first mouse button
|
||||
if (event.event.button > 0 || !this.mode) return; // only first mouse button
|
||||
this._modeMap[this.mode].onMouseUp(event);
|
||||
this.mode = ReshapeModes.SELECTION_BOX;
|
||||
}
|
||||
|
|
|
@ -24,11 +24,13 @@ class SelectionBoxTool {
|
|||
}
|
||||
}
|
||||
onMouseDrag (event) {
|
||||
if (event.event.button > 0) return; // only first mouse button
|
||||
this.selectionRect = rectSelect(event);
|
||||
// Remove this rect on the next drag and up event
|
||||
this.selectionRect.removeOnDrag();
|
||||
}
|
||||
onMouseUp (event) {
|
||||
if (event.event.button > 0) return; // only first mouse button
|
||||
if (this.selectionRect) {
|
||||
processRectangularSelection(event, this.selectionRect, this.mode);
|
||||
this.selectionRect.remove();
|
||||
|
|
Loading…
Reference in a new issue