kopia lustrzana https://github.com/backface/turtlestitch
adjusted rotation center of SVG-pen-trails
rodzic
e66046e71e
commit
391be73691
|
@ -12,6 +12,7 @@
|
|||
* new dev version
|
||||
* objects: export pen trails as SVG (under construction)
|
||||
* threads: new "pen trails (SVG)" reporter (experimental, hidden in dev)
|
||||
* objects, threads: adjusted rotation center of SVG-pen-trails
|
||||
|
||||
## v5.3.8:
|
||||
* **Notable Change:**
|
||||
|
|
|
@ -5288,7 +5288,7 @@ SpriteMorph.prototype.floodFill = function () {
|
|||
|
||||
// SpriteMorph pen trails as costume
|
||||
|
||||
SpriteMorph.prototype.reportPenTrailsAsCostume = function () {
|
||||
SpriteMorph.prototype.reportPenTrailsAsCostume = function () { // +++
|
||||
var cst = new Costume(
|
||||
this.parentThatIsA(StageMorph).trailsCanvas,
|
||||
this.newCostumeName(localize('Costume'))
|
||||
|
@ -8927,7 +8927,7 @@ StageMorph.prototype.exportTrailsLogAsSVG = function () { // +++
|
|||
var ide = this.parentThatIsA(IDE_Morph);
|
||||
|
||||
ide.saveFileAs(
|
||||
this.trailsLogAsSVG(),
|
||||
this.trailsLogAsSVG().src,
|
||||
'image/svg', // +++'image/svg+xml',
|
||||
ide.projectName || this.name
|
||||
);
|
||||
|
@ -8981,7 +8981,10 @@ StageMorph.prototype.trailsLogAsSVG = function () { // +++
|
|||
'" />';
|
||||
});
|
||||
svg += '</svg>';
|
||||
return svg;
|
||||
return {
|
||||
src : svg,
|
||||
rot : new Point(-box.origin.x, box.corner.y)
|
||||
};
|
||||
};
|
||||
|
||||
StageMorph.prototype.normalizePoint = function (snapPoint) { // +++
|
||||
|
|
|
@ -5121,18 +5121,21 @@ Process.prototype.reportPentrailsAsSVG = function () { // +++
|
|||
svg = stage.trailsLogAsSVG();
|
||||
this.context.accumulator = {
|
||||
img : new Image(),
|
||||
rot : svg.rot,
|
||||
ready : false
|
||||
};
|
||||
acc = this.context.accumulator;
|
||||
acc.img.onload = function () {
|
||||
acc.ready = true;
|
||||
};
|
||||
acc.img.src = 'data:image/svg+xml,' + svg;
|
||||
acc.img.src = 'data:image/svg+xml,' + svg.src;
|
||||
acc.img.rot = svg.rotationShift;
|
||||
} else if (this.context.accumulator.ready) {
|
||||
this.returnValueToParentContext(
|
||||
new SVG_Costume(
|
||||
this.context.accumulator.img,
|
||||
this.blockReceiver().newCostumeName(localize('Costume'))
|
||||
this.blockReceiver().newCostumeName(localize('Costume')),
|
||||
this.context.accumulator.rot
|
||||
)
|
||||
);
|
||||
return;
|
||||
|
|
Ładowanie…
Reference in New Issue