From 52e86e0f0d6f8e608fc76f07f8f2edbabc8ef5a6 Mon Sep 17 00:00:00 2001 From: jmoenig Date: Sun, 28 Jun 2020 12:42:06 +0200 Subject: [PATCH] make sure long project titles don't overlap other controls in the IDE --- HISTORY.md | 1 + snap.html | 2 +- src/gui.js | 25 ++++++++++++++++++------- 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/HISTORY.md b/HISTORY.md index 8a85a23c..5a52a6c5 100755 --- a/HISTORY.md +++ b/HISTORY.md @@ -35,6 +35,7 @@ * fixed editing cells in multi-page list watchers * recursive calls to "broadcast and wait" execute smoothly again * expanding a collapsed comment or clicking on it now brings it to the front + * long project titles no longer overlap other buttons in the control bar * **Translation Updates:** * New Hebrew translation * Ukranian diff --git a/snap.html b/snap.html index bb45346e..30c59095 100755 --- a/snap.html +++ b/snap.html @@ -10,7 +10,7 @@ - + diff --git a/src/gui.js b/src/gui.js index 4e983fef..656041fa 100644 --- a/src/gui.js +++ b/src/gui.js @@ -78,7 +78,7 @@ Animation, BoxMorph, BlockEditorMorph, BlockDialogMorph, Note*/ // Global stuff //////////////////////////////////////////////////////// -modules.gui = '2020-June-24'; +modules.gui = '2020-June-28'; // Declarations @@ -1076,7 +1076,8 @@ IDE_Morph.prototype.createControlBar = function () { this.controlBar.updateLabel = function () { var suffix = myself.world().isDevMode ? - ' - ' + localize('development mode') : ''; + ' - ' + localize('development mode') : '', + txt; if (this.label) { this.label.destroy(); @@ -1084,8 +1085,7 @@ IDE_Morph.prototype.createControlBar = function () { if (myself.isAppMode) { return; } - - this.label = new StringMorph( + txt = new StringMorph( (myself.projectName || localize('untitled')) + suffix, 14, 'sans-serif', @@ -1095,11 +1095,22 @@ IDE_Morph.prototype.createControlBar = function () { MorphicPreferences.isFlat ? null : new Point(2, 1), myself.frameColor.darker(myself.buttonContrast) ); - this.label.color = myself.buttonLabelColor; - this.label.fixLayout(); - this.add(this.label); + txt.color = myself.buttonLabelColor; + + this.label = new FrameMorph(); + this.label.acceptsDrops = false; + this.label.alpha = 0; + txt.setPosition(this.label.position()); + this.label.add(txt); + this.label.setExtent( + new Point( + steppingButton.left() - settingsButton.right() - padding * 2, + txt.height() + ) + ); this.label.setCenter(this.center()); this.label.setLeft(this.settingsButton.right() + padding); + this.add(this.label); }; };