From 4e1350837d33e21df2dd503b847f7ca59c10e69a Mon Sep 17 00:00:00 2001 From: jmoenig Date: Thu, 5 Dec 2019 23:28:57 +0100 Subject: [PATCH] set the rotation point of "pen vectors" costumes to the position of the sprite that creates them --- HISTORY.md | 3 +++ snap.html | 2 +- src/threads.js | 11 ++++++++--- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/HISTORY.md b/HISTORY.md index 8f46310d..f6949173 100755 --- a/HISTORY.md +++ b/HISTORY.md @@ -10,6 +10,9 @@ * **Translation Updates:** * German +### 2019-12-05 +* threads: set the rotation point of "pen vectors" costumes to the position of the sprite that creates them + ### 2019-12-03 * objects, blocks, threads, gui: added "log pen vectors" session setting * updated German translation diff --git a/snap.html b/snap.html index 78401c8d..a438629d 100755 --- a/snap.html +++ b/snap.html @@ -7,7 +7,7 @@ - + diff --git a/src/threads.js b/src/threads.js index 2998a3c4..dc3f26ee 100644 --- a/src/threads.js +++ b/src/threads.js @@ -61,7 +61,7 @@ StageMorph, SpriteMorph, StagePrompterMorph, Note, modules, isString, copy, isNil, WatcherMorph, List, ListWatcherMorph, alert, console, TableMorph, Color, TableFrameMorph, ColorSlotMorph, isSnapObject, newCanvas, Symbol, SVG_Costume*/ -modules.threads = '2019-December-02'; +modules.threads = '2019-December-05'; var ThreadManager; var Process; @@ -5119,7 +5119,7 @@ Process.prototype.reportNewCostume = function (pixels, width, height, name) { Process.prototype.reportPentrailsAsSVG = function () { // interpolated - var stage, svg, acc; + var rcvr, stage, svg, acc, offset; if (!this.context.accumulator) { stage = this.homeContext.receiver.parentThatIsA(StageMorph); @@ -5141,11 +5141,16 @@ Process.prototype.reportPentrailsAsSVG = function () { acc.img.src = 'data:image/svg+xml,' + svg.src; acc.img.rot = svg.rotationShift; } else if (this.context.accumulator.ready) { + offset = new Point(0, 0); + rcvr = this.blockReceiver(); + if (rcvr instanceof SpriteMorph) { + offset = new Point(rcvr.xPosition(), -rcvr.yPosition()); + } this.returnValueToParentContext( new SVG_Costume( this.context.accumulator.img, this.blockReceiver().newCostumeName(localize('Costume')), - this.context.accumulator.rot + this.context.accumulator.rot.translateBy(offset) ) ); return;