mirror of
https://github.com/scratchfoundation/scratch-flash.git
synced 2024-12-13 09:31:15 -05:00
Merge pull request #259 from nathan/fix-pencil-keyup
Fixed pressing keys while drawing with the pencil
This commit is contained in:
commit
2527a113be
1 changed files with 5 additions and 11 deletions
|
@ -81,7 +81,7 @@ package svgeditor.tools
|
||||||
if(previewShape.parent) previewShape.parent.removeChild(previewShape);
|
if(previewShape.parent) previewShape.parent.removeChild(previewShape);
|
||||||
super.shutdown();
|
super.shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
private function onKeyPress(e:KeyboardEvent):void {
|
private function onKeyPress(e:KeyboardEvent):void {
|
||||||
shiftDown = e.shiftKey;
|
shiftDown = e.shiftKey;
|
||||||
}
|
}
|
||||||
|
@ -89,12 +89,6 @@ package svgeditor.tools
|
||||||
private function onKeyRelease(e:KeyboardEvent):void {
|
private function onKeyRelease(e:KeyboardEvent):void {
|
||||||
shiftDown = e.shiftKey;
|
shiftDown = e.shiftKey;
|
||||||
if(currentEvent) currentEvent.shiftKey = e.shiftKey;
|
if(currentEvent) currentEvent.shiftKey = e.shiftKey;
|
||||||
|
|
||||||
// Store start straight line segment
|
|
||||||
if(newElement) {
|
|
||||||
newElement.path.push(['L', mouseX, mouseY]);
|
|
||||||
lastSavePt = new Point(mouseX, mouseY);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override protected function mouseDown(p:Point):void {
|
override protected function mouseDown(p:Point):void {
|
||||||
|
@ -280,7 +274,7 @@ previewShape.graphics.lineTo(proj.x, proj.y);
|
||||||
var cPts:Array = SVGPath.getControlPointsAdjacentAnchor(before, here, after);
|
var cPts:Array = SVGPath.getControlPointsAdjacentAnchor(before, here, after);
|
||||||
var c1:Point = cPts[0];
|
var c1:Point = cPts[0];
|
||||||
var c2:Point = cPts[1];
|
var c2:Point = cPts[1];
|
||||||
|
|
||||||
SVGPath.drawCubicBezier(gfx, before, lastSaveC2, c1, here, null, null);
|
SVGPath.drawCubicBezier(gfx, before, lastSaveC2, c1, here, null, null);
|
||||||
newElement.path.push(['C', lastSaveC2.x, lastSaveC2.y, c1.x, c1.y, here.x, here.y]);
|
newElement.path.push(['C', lastSaveC2.x, lastSaveC2.y, c1.x, c1.y, here.x, here.y]);
|
||||||
lastSaveC2 = c2;
|
lastSaveC2 = c2;
|
||||||
|
@ -371,7 +365,7 @@ previewShape.graphics.lineTo(proj.x, proj.y);
|
||||||
newElement.path[lastIdx][6] = p.y;
|
newElement.path[lastIdx][6] = p.y;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
processPath();
|
processPath();
|
||||||
}
|
}
|
||||||
else if(newElement.path.length) {
|
else if(newElement.path.length) {
|
||||||
|
@ -624,7 +618,7 @@ previewShape.graphics.lineTo(proj.x, proj.y);
|
||||||
var tmp:SVGPath = path;
|
var tmp:SVGPath = path;
|
||||||
path = pathReversed;
|
path = pathReversed;
|
||||||
pathReversed = tmp;
|
pathReversed = tmp;
|
||||||
|
|
||||||
var tmpPt:Point = firstPt;
|
var tmpPt:Point = firstPt;
|
||||||
firstPt = secondPt;
|
firstPt = secondPt;
|
||||||
secondPt = tmpPt;
|
secondPt = tmpPt;
|
||||||
|
@ -709,7 +703,7 @@ previewShape.graphics.lineTo(proj.x, proj.y);
|
||||||
svgShape.visible = false;
|
svgShape.visible = false;
|
||||||
svgShape.redraw();
|
svgShape.redraw();
|
||||||
svgShape.visible = true;
|
svgShape.visible = true;
|
||||||
|
|
||||||
return wasUsed;
|
return wasUsed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue