kopia lustrzana https://github.com/backface/turtlestitch
migrated costume editor (rotation-point only dialog)
rodzic
f98f2e9539
commit
dab8be8a0a
|
@ -84,7 +84,7 @@ BlockEditorMorph, BlockDialogMorph, PrototypeHatBlockMorph, BooleanSlotMorph,
|
||||||
localize, TableMorph, TableFrameMorph, normalizeCanvas, VectorPaintEditorMorph,
|
localize, TableMorph, TableFrameMorph, normalizeCanvas, VectorPaintEditorMorph,
|
||||||
HandleMorph, AlignmentMorph, Process, XML_Element, WorldMap, copyCanvas*/
|
HandleMorph, AlignmentMorph, Process, XML_Element, WorldMap, copyCanvas*/
|
||||||
|
|
||||||
modules.objects = '2020-April-12';
|
modules.objects = '2020-April-15';
|
||||||
|
|
||||||
var SpriteMorph;
|
var SpriteMorph;
|
||||||
var StageMorph;
|
var StageMorph;
|
||||||
|
@ -9865,6 +9865,7 @@ Costume.prototype.editRotationPointOnly = function (aWorld) {
|
||||||
dialog,
|
dialog,
|
||||||
txt;
|
txt;
|
||||||
|
|
||||||
|
editor.fixLayout();
|
||||||
action = function () {editor.accept(); };
|
action = function () {editor.accept(); };
|
||||||
dialog = new DialogBoxMorph(this, action);
|
dialog = new DialogBoxMorph(this, action);
|
||||||
txt = new TextMorph(
|
txt = new TextMorph(
|
||||||
|
@ -9887,8 +9888,6 @@ Costume.prototype.editRotationPointOnly = function (aWorld) {
|
||||||
dialog.addButton('ok', 'Ok');
|
dialog.addButton('ok', 'Ok');
|
||||||
dialog.addButton('cancel', 'Cancel');
|
dialog.addButton('cancel', 'Cancel');
|
||||||
dialog.fixLayout();
|
dialog.fixLayout();
|
||||||
dialog.drawNew();
|
|
||||||
dialog.fixLayout();
|
|
||||||
dialog.popUp(aWorld);
|
dialog.popUp(aWorld);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -10138,30 +10137,29 @@ CostumeEditorMorph.prototype.accept = function () {
|
||||||
|
|
||||||
// CostumeEditorMorph displaying
|
// CostumeEditorMorph displaying
|
||||||
|
|
||||||
CostumeEditorMorph.prototype.drawNew = function () {
|
CostumeEditorMorph.prototype.fixLayout = function () {
|
||||||
var rp, ctx;
|
this.bounds.setExtent(this.size);
|
||||||
|
};
|
||||||
|
|
||||||
|
CostumeEditorMorph.prototype.render = function (ctx) {
|
||||||
|
var rp;
|
||||||
|
|
||||||
this.margin = this.size.subtract(this.costume.extent()).divideBy(2);
|
this.margin = this.size.subtract(this.costume.extent()).divideBy(2);
|
||||||
rp = this.rotationCenter.add(this.margin);
|
rp = this.rotationCenter.add(this.margin);
|
||||||
|
|
||||||
this.silentSetExtent(this.size);
|
|
||||||
|
|
||||||
this.image = newCanvas(this.extent());
|
|
||||||
|
|
||||||
// draw the background
|
// draw the background
|
||||||
if (!this.cachedTexture) {
|
if (!this.cachedTexture) {
|
||||||
this.cachedTexture = this.createTexture();
|
this.cachedTexture = this.createTexture();
|
||||||
|
|
||||||
}
|
}
|
||||||
this.drawCachedTexture();
|
this.renderCachedTexture(ctx);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
pattern = ctx.createPattern(this.background, 'repeat');
|
pattern = ctx.createPattern(this.background, 'repeat');
|
||||||
ctx.fillStyle = pattern;
|
ctx.fillStyle = pattern;
|
||||||
ctx.fillRect(0, 0, this.size.x, this.size.y);
|
ctx.fillRect(0, 0, this.size.x, this.size.y);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ctx = this.image.getContext('2d');
|
|
||||||
|
|
||||||
// draw the costume
|
// draw the costume
|
||||||
ctx.drawImage(this.costume.contents, this.margin.x, this.margin.y);
|
ctx.drawImage(this.costume.contents, this.margin.x, this.margin.y);
|
||||||
|
@ -10229,8 +10227,7 @@ CostumeEditorMorph.prototype.mouseDownLeft = function (pos) {
|
||||||
this.rotationCenter = pos.subtract(
|
this.rotationCenter = pos.subtract(
|
||||||
this.position().add(this.margin)
|
this.position().add(this.margin)
|
||||||
);
|
);
|
||||||
this.drawNew();
|
this.rerender();
|
||||||
this.changed();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
CostumeEditorMorph.prototype.mouseMove
|
CostumeEditorMorph.prototype.mouseMove
|
||||||
|
|
Ładowanie…
Reference in New Issue