From 1db69bd4a1742f76e42ca34ae04b4401909f57fa Mon Sep 17 00:00:00 2001 From: Michael Aschauer Date: Wed, 16 Jan 2019 22:47:24 -0800 Subject: [PATCH] correct display of XRay checkbox --- stitchcode/gui.js | 56 +++++++++++++++++++++++-------------------- stitchcode/objects.js | 5 +++- 2 files changed, 34 insertions(+), 27 deletions(-) diff --git a/stitchcode/gui.js b/stitchcode/gui.js index 2a7412a0..faa5c1c3 100644 --- a/stitchcode/gui.js +++ b/stitchcode/gui.js @@ -1031,9 +1031,9 @@ IDE_Morph.prototype.aboutTurtleStitch = function () { IDE_Morph.prototype.createStatusDisplay = function () { var frame, padding = 1, - myself = this, - elements = [], - stage = this.stage; + myself = this, + elements = [], + stage = this.stage; if (this.statusDisplay) { this.statusDisplay.destroy(); @@ -1254,31 +1254,35 @@ IDE_Morph.prototype.createStatusDisplay = function () { resetCameraButton.columns = 4; resetCameraButton.newColumn = 2; + var XRayButton = new ToggleMorph( - 'checkbox', - null, - function () { - if (stage.isXRay) { - myself.showMessage("turn off X-RAY ..."); - window.setTimeout( - function() { - stage.turnXRayOff(); - myself.showMessage("done",0.4); - }, 250); - } else { - myself.showMessage("rendering X-RAY ..."); - window.setTimeout( - function() { - stage.turnXRayOn(); - myself.showMessage("done", 0.4); - } ,250); - } - }, - 'X-Ray', - function () { - return stage.isXRay; - }); + 'checkbox', + null, + function () { + if (stage.isXRay) { + myself.showMessage("turn off X-RAY ..."); + window.setTimeout( + function() { + stage.turnXRayOff(); + myself.showMessage("done",0.4); + myself.XRayButton.refresh(); + }, 250); + } else { + myself.showMessage("rendering X-RAY ..."); + window.setTimeout( + function() { + stage.turnXRayOn(); + myself.showMessage("done", 0.4); + myself.XRayButton.refresh(); + } ,250); + } + }, + 'X-Ray', + function () { + return stage.getIsXRay(); + }); elements.push(XRayButton); + myself.XRayButton = XRayButton; XRayButton.columns = 4; XRayButton.newColumn = 3; diff --git a/stitchcode/objects.js b/stitchcode/objects.js index c66a99f4..7dfbb73b 100644 --- a/stitchcode/objects.js +++ b/stitchcode/objects.js @@ -2859,7 +2859,6 @@ StageMorph.prototype.turnXRayOn = function () { this.children[0].addStitch(stitch[0][0], stitch[0][1], stitch[1][0], stitch[1][1], angle) } - this.renderer.changed = true; } @@ -2908,6 +2907,10 @@ StageMorph.prototype.turnXRayOff = function () { } +StageMorph.prototype.getIsXRay = function () { + return this.isXRay; +} + StageMorph.prototype.clearPenTrails = nop; StageMorph.prototype.penTrails = function () {