Skip to content

Commit

Permalink
right-click selects secondary color in vector paint editor
Browse files Browse the repository at this point in the history
  • Loading branch information
jmoenig committed Jun 20, 2018
1 parent e0c30c1 commit 761418c
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
4 changes: 4 additions & 0 deletions history.txt
Expand Up @@ -4170,6 +4170,10 @@ in development:
------
* Threads: added capability to JIT-compile command scripts to JS

180620
------
* Sketch: enable right-click to select secondary color in vector paint editor


=== v4.2 major release (draft) ===

Expand Down
14 changes: 13 additions & 1 deletion sketch.js
Expand Up @@ -50,14 +50,16 @@
2018, June 5 (Jens):
- fixed initial rotation center for an existing costume
- fixed initial rendering, so costumes can be re-opened after saving
2018, June 20 (Jens):
- select primary color with right-click (in addition to shift-click)
*/

/*global Point, Object, Rectangle, AlignmentMorph, Morph, XML_Element, nop,
PaintColorPickerMorph, Color, SliderMorph, InputFieldMorph, ToggleMorph,
TextMorph, Image, newCanvas, PaintEditorMorph, StageMorph, Costume, isNil,
localize, PaintCanvasMorph, detect, modules*/

modules.sketch = '2018-June-05';
modules.sketch = '2018-June-20';

// Declarations

Expand Down Expand Up @@ -1275,6 +1277,16 @@ VectorPaintEditorMorph.prototype.populatePropertiesMenu = function () {
}
);

// allow right-click on the color picker to select the secondary color
pc.colorpicker.mouseDownRight = function (pos) {
if ((pos.subtract(this.position()).x > this.width() * 2 / 3) &&
(pos.subtract(this.position()).y > this.height() - 10)) {
this.action("transparent", true);
} else {
this.action(this.getPixelColor(pos), true);
}
};

pc.colorpicker.action(new Color(0, 0, 0));
pc.colorpicker.action('transparent', true); // secondary color

Expand Down
2 changes: 1 addition & 1 deletion snap.html
Expand Up @@ -15,7 +15,7 @@
<script type="text/javascript" src="byob.js?version=2018-06-14"></script>
<script type="text/javascript" src="tables.js?version=2018-06-14"></script>
<script type="text/javascript" src="symbols.js?version=2018-06-14"></script>
<script type="text/javascript" src="sketch.js?version=2018-06-14"></script>
<script type="text/javascript" src="sketch.js?version=2018-06-20"></script>
<script type="text/javascript" src="xml.js?version=2018-06-14"></script>
<script type="text/javascript" src="store.js?version=2018-06-14"></script>
<script type="text/javascript" src="locale.js?version=2018-06-14"></script>
Expand Down

0 comments on commit 761418c

Please sign in to comment.