Skip to content

Commit 80e682e

Browse files
committed
Use a shim in ImageEdit when CursorTool is active
Instead of ImageEdit activating the selection tool while CursorTool is active, it now activates a do-nothing shim tool that serves as a placeholder specifically for CursorTool. Also, switch to the selection too in ImageEdit when CursorTool is done.
1 parent cf4f874 commit 80e682e

File tree

2 files changed

+32
-3
lines changed

2 files changed

+32
-3
lines changed

src/svgeditor/ImageEdit.as

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -239,9 +239,7 @@ package svgeditor {
239239
public function enableTools(enabled:Boolean):void {
240240
uiLayer.mouseChildren = enabled;
241241
uiLayer.alpha = enabled ? 1.0 : 0.6;
242-
if (!enabled) {
243-
setToolMode('select');
244-
}
242+
setToolMode(enabled ? 'select' : 'cursorTool');
245243
}
246244

247245
public function isActive():Boolean {
@@ -607,6 +605,7 @@ package svgeditor {
607605
case 'bitmapEraser': currentTool = new BitmapPencilTool(this, true); break;
608606
case 'bitmapSelect': currentTool = new ObjectTransformer(this); break;
609607
case 'paintbucket': currentTool = new PaintBucketTool(this); break;
608+
case 'cursorTool': currentTool = new CursorToolShim(this); break;
610609
}
611610

612611
if(currentTool is SVGEditTool) {

src/svgeditor/tools/CursorToolShim.as

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/*
2+
* Scratch Project Editor and Player
3+
* Copyright (C) 2014 Massachusetts Institute of Technology
4+
*
5+
* This program is free software; you can redistribute it and/or
6+
* modify it under the terms of the GNU General Public License
7+
* as published by the Free Software Foundation; either version 2
8+
* of the License, or (at your option) any later version.
9+
*
10+
* This program is distributed in the hope that it will be useful,
11+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
* GNU General Public License for more details.
14+
*
15+
* You should have received a copy of the GNU General Public License
16+
* along with this program; if not, write to the Free Software
17+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18+
*/
19+
20+
package svgeditor.tools {
21+
import svgeditor.ImageEdit;
22+
23+
// This class is a valid but empty tool used as a placeholder while a legacy tool in CursorTool.as has control.
24+
public class CursorToolShim extends SVGEditTool {
25+
26+
public function CursorToolShim(ed:ImageEdit) {
27+
super(ed);
28+
}
29+
}
30+
}

0 commit comments

Comments
 (0)