diff --git a/history.txt b/history.txt index 339b821b..36650e1b 100755 --- a/history.txt +++ b/history.txt @@ -4119,3 +4119,7 @@ in development: 180604 ------ * Blocks: tweaked layout of variadic C-shaped input slots + +180605 +------ +* VectorPaint: fixed rotation center editing for existing costumes diff --git a/objects.js b/objects.js index 7fa74266..98a64e4a 100644 --- a/objects.js +++ b/objects.js @@ -83,7 +83,7 @@ BlockEditorMorph, BlockDialogMorph, PrototypeHatBlockMorph, localize, TableMorph, TableFrameMorph, normalizeCanvas, BooleanSlotMorph, HandleMorph, AlignmentMorph, Process, XML_Element, VectorPaintEditorMorph*/ -modules.objects = '2018-May-02'; +modules.objects = '2018-June-05'; var SpriteMorph; var StageMorph; @@ -8472,12 +8472,8 @@ SVG_Costume.prototype.edit = function ( editor.oncancel = oncancel || nop; editor.openIn( aWorld, - isnew ? - newCanvas(StageMorph.prototype.dimensions) : - this.contents, - isnew ? - new Point(240, 180) : - myself.rotationCenter, + isnew ? newCanvas(StageMorph.prototype.dimensions) : this.contents, + isnew ? new Point(240, 180) : myself.rotationCenter, function (img, rc, shapes) { myself.contents = img; myself.rotationCenter = rc; diff --git a/vectorPaint.js b/vectorPaint.js index 4a36051b..107b0821 100644 --- a/vectorPaint.js +++ b/vectorPaint.js @@ -44,6 +44,10 @@ ------- Carles Paredes wrote the first working prototype in 2015 Bernat Romagosa rewrote most of the code in 2017 + + revision history + ---------------- + 2018, June 5 - fixed initial rotation center for an existing costume (Jens) */ /*global Point, Object, Rectangle, AlignmentMorph, Morph, XML_Element, nop, @@ -51,7 +55,7 @@ PaintColorPickerMorph, Color, SliderMorph, InputFieldMorph, ToggleMorph, TextMorph, Image, newCanvas, PaintEditorMorph, StageMorph, Costume, isNil, localize, PaintCanvasMorph, detect, modules*/ -modules.vectorPaint = '2018-March-19'; +modules.vectorPaint = '2018-June-05'; // Declarations @@ -987,12 +991,11 @@ VectorPaintEditorMorph.prototype.buildScaleBox = function () { }; VectorPaintEditorMorph.prototype.openIn = function (world, oldim, oldrc, callback, anIDE, shapes) { - var myself = this; + var myself = this, + isEmpty = isNil(shapes) || shapes.length === 0; VectorPaintEditorMorph.uber.openIn.call(this, world, null, oldrc, callback); - this.paper.automaticCrosshairs = isNil(shapes) || shapes.length === 0; - this.shapes = shapes.map(function (eachShape) { return eachShape.copy(); }); this.ide = anIDE; @@ -1003,6 +1006,14 @@ VectorPaintEditorMorph.prototype.openIn = function (world, oldim, oldrc, callbac shape.drawOn(myself.paper); }); + // init the rotation center, if any + if (oldrc && !isEmpty) { + this.paper.automaticCrosshairs = false; + this.paper.rotationCenter = this.getBounds(this.shapes).origin.subtract(this.paper.bounds.origin).add(oldrc); + } else { + this.paper.automaticCrosshairs = true; + } + this.updateHistory(); this.processKeyUp = function () {