From f48f7cae1e9cb2e4b808112090fb4d40653c95aa Mon Sep 17 00:00:00 2001 From: brianharvey Date: Wed, 20 Feb 2019 22:20:54 -0800 Subject: [PATCH 1/2] fix pipette bug Shift-click on pipette button makes it work on fill color instead of edge. (The shiftness is the click on the button itself, unlike other buttons, but pipette is different anyway because when you let go it switches back to the old button selection.) --- src/paint.js | 3 ++- src/sketch.js | 31 ++++++++++++++----------------- 2 files changed, 16 insertions(+), 18 deletions(-) diff --git a/src/paint.js b/src/paint.js index 27644dde..a6fd129a 100644 --- a/src/paint.js +++ b/src/paint.js @@ -495,6 +495,7 @@ PaintEditorMorph.prototype.getUserColor = function () { var myself = this, world = this.world(), hand = world.hand, + shifted = this.paper.isShiftPressed(); posInDocument = getDocumentPositionOf(world.worldCanvas), mouseMoveBak = hand.processMouseMove, mouseDownBak = hand.processMouseDown, @@ -513,7 +514,7 @@ PaintEditorMorph.prototype.getUserColor = function () { return; } color.a = 255; - myself.propertiesControls.colorpicker.action(color); + myself.propertiesControls.colorpicker.action(color,shifted); }; hand.processMouseDown = nop; diff --git a/src/sketch.js b/src/sketch.js index ea90b98f..d338d225 100644 --- a/src/sketch.js +++ b/src/sketch.js @@ -59,7 +59,7 @@ PaintColorPickerMorph, Color, SliderMorph, InputFieldMorph, ToggleMorph, TextMorph, Image, newCanvas, PaintEditorMorph, StageMorph, Costume, isNil, localize, PaintCanvasMorph, detect, modules*/ -modules.sketch = '2018-June-20'; +modules.sketch = '2019-February-20'; // Declarations @@ -1020,7 +1020,7 @@ VectorPaintEditorMorph.prototype.convertToBitmap = function () { VectorPaintEditorMorph.prototype.buildScaleBox = function () { var myself = this; - ['Frontmost', 'Backmost', 'Front', 'Back'].forEach(function (label) { + ['Top', 'Bottom', 'Up', 'Down'].forEach(function (label) { myself.scaleBox.add( myself.pushButton( label, @@ -1109,20 +1109,20 @@ VectorPaintEditorMorph.prototype.openIn = function ( break; /* Page Up key */ case 33: - this.changeSelectionLayer('front'); + this.changeSelectionLayer('up'); break; /* Page Down key */ case 34: - this.changeSelectionLayer('back'); + this.changeSelectionLayer('down'); break; /* End key */ case 35: - this.changeSelectionLayer('backmost'); + this.changeSelectionLayer('bottom'); break; /* Home key */ case 36: - this.changeSelectionLayer('frontmost'); + this.changeSelectionLayer('top'); break; case 90: /* Ctrl + Z */ @@ -1223,9 +1223,9 @@ VectorPaintEditorMorph.prototype.buildToolbox = function () { polygon: 'Polygon', paintbucket: - 'Paint a shape\n(shift: secondary color)', + 'Paint a shape\n(shift: edge color)', pipette: - 'Pipette tool\n(pick a color from anywhere\nshift: secondary color)' + 'Pipette tool\n(pick a color from anywhere\nshift: fill color)' }, myself = this, left = this.toolbox.left(), @@ -1344,19 +1344,16 @@ VectorPaintEditorMorph.prototype.populatePropertiesMenu = function () { alignColor.add(pc.primaryColorViewer); alignColor.fixLayout(); - alignNames.add(new TextMorph(localize('Edge color'), + alignNames.add(new TextMorph(localize('Edge color\n(left click)'), null, null, null, null, 'center', 85)); - alignNames.add(new TextMorph(localize('Fill color'), + alignNames.add(new TextMorph(localize('Fill color\n(right click)'), null, null, null, null, 'center', 85)); alignNames.fixLayout(); c.add(pc.colorpicker); c.add(alignNames); -// c.add(new TextMorph(localize(' Edge color Fill color'))); c.add(alignColor); - c.add(new TextMorph(localize('Right-click/Control-click to set Fill'))); - c.add(new TextMorph(localize('Brush size'))); c.add(alpen); c.add(pc.constrain); @@ -1416,26 +1413,26 @@ VectorPaintEditorMorph.prototype.changeSelectionLayer = function (destination) { this.sortSelection(); switch (destination) { - case 'frontmost': + case 'top': this.selection.forEach(function (shape) { myself.shapes.splice(myself.shapes.indexOf(shape), 1); myself.shapes.push(shape); }); break; - case 'backmost': + case 'bottom': this.selection.slice().reverse().forEach(function (shape) { myself.shapes.splice(myself.shapes.indexOf(shape), 1); myself.shapes.splice(0, 0, shape); }); break; - case 'front': + case 'up': this.selection.forEach(function (shape) { var index = myself.shapes.indexOf(shape); myself.shapes.splice(index, 1); myself.shapes.splice(index + myself.selection.length, 0, shape); }); break; - case 'back': + case 'down': if (this.shapes[0] !== this.selection[0]) { this.selection.forEach(function (shape) { var index = myself.shapes.indexOf(shape); From dfd9b78f48f7600f4753d6d4496bc257234d57c7 Mon Sep 17 00:00:00 2001 From: Bernat Romagosa Date: Thu, 21 Feb 2019 07:41:08 +0100 Subject: [PATCH 2/2] Formatting --- src/paint.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/paint.js b/src/paint.js index a6fd129a..b1c58d0d 100644 --- a/src/paint.js +++ b/src/paint.js @@ -495,7 +495,7 @@ PaintEditorMorph.prototype.getUserColor = function () { var myself = this, world = this.world(), hand = world.hand, - shifted = this.paper.isShiftPressed(); + shifted = this.paper.isShiftPressed(); posInDocument = getDocumentPositionOf(world.worldCanvas), mouseMoveBak = hand.processMouseMove, mouseDownBak = hand.processMouseDown, @@ -514,7 +514,7 @@ PaintEditorMorph.prototype.getUserColor = function () { return; } color.a = 255; - myself.propertiesControls.colorpicker.action(color,shifted); + myself.propertiesControls.colorpicker.action(color, shifted); }; hand.processMouseDown = nop;