File tree 1 file changed +9
-5
lines changed 1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -178,13 +178,17 @@ public class ScratchComment extends Sprite {
178
178
179
179
public function menu (evt :MouseEvent ):Menu {
180
180
var m: Menu = new Menu ();
181
- m. addItem ('duplicate' , duplicateComment);
181
+ var startX: Number = stage . mouseX ;
182
+ var startY: Number = stage . mouseY ;
183
+ m. addItem ('duplicate' , function (): void {
184
+ duplicateComment(stage . mouseX - startX, stage . mouseY - startY);
185
+ });
182
186
m. addItem ('delete' , deleteComment);
183
187
return m;
184
188
}
185
189
186
190
public function handleTool (tool :String , evt :MouseEvent ):void {
187
- if (tool == 'copy' ) duplicateComment();
191
+ if (tool == 'copy' ) duplicateComment(10 , 5 );
188
192
if (tool == 'cut' ) deleteComment();
189
193
}
190
194
@@ -194,11 +198,11 @@ public class ScratchComment extends Sprite {
194
198
Scratch. app. scriptsPane. saveScripts();
195
199
}
196
200
197
- public function duplicateComment ():void {
201
+ public function duplicateComment (deltaX : Number , deltaY : Number ):void {
198
202
if (! parent ) return ;
199
203
var dup: ScratchComment = new ScratchComment(contents. text , isOpen);
200
- dup. x = x + 10 ;
201
- dup. y = y + 10 ;
204
+ dup. x = x + deltaX ;
205
+ dup. y = y + deltaY ;
202
206
parent . addChild (dup);
203
207
Scratch. app. gh. grabOnMouseUp(dup);
204
208
}
You can’t perform that action at this time.
0 commit comments