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.)
pull/89/head
brianharvey 2019-02-20 22:20:54 -08:00
rodzic e7dd0aa8ec
commit f48f7cae1e
2 zmienionych plików z 16 dodań i 18 usunięć

Wyświetl plik

@ -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;

Wyświetl plik

@ -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);