diff options
| author | Michael Ball <cycomachead@gmail.com> | 2014-11-24 15:13:51 -0800 |
|---|---|---|
| committer | Michael Ball <cycomachead@gmail.com> | 2014-11-24 15:13:51 -0800 |
| commit | 94f94467b5be3d05f108620d1a17f6d4179bf621 (patch) | |
| tree | 0d62b96277a2c919d28632850cb5d8938ec69092 /morphic.js | |
| parent | 9e5fb9a4cba980c977d4e11e5c9a4e7f9c8596db (diff) | |
| parent | 4be96bb240ea8518fa95218cba7111846af93baa (diff) | |
| download | snap-94f94467b5be3d05f108620d1a17f6d4179bf621.tar.gz snap-94f94467b5be3d05f108620d1a17f6d4179bf621.zip | |
Merge branch 'master' of git://github.com/jmoenig/Snap--Build-Your-Own-Blocks into shared-url
* 'master' of git://github.com/jmoenig/Snap--Build-Your-Own-Blocks: (34 commits)
tail-call-elimination for reporters - experiment
allow recursive reporters to be stopped by user
updated history
fixed #131
Fixed #34
Fixed #644
Fixed #372
Fixed #416
Fixed #318
Fix “stop this block” primitive for tail-call-elimination
Fix "stop this block"’s lexical awareness
Add a new Favicon to Snap! (Clearer Lambda)
integrate translation update
push morphic.js version date
fix ‘line’ option in ‘split’ block for Windows files
integrate percent sign fix for JSLint
Updated the “About” Dialog
renamed Process::callback to "onComplete"
Fixed #364 avoid “freezing” when calling LAUNCH on empty ring
Fixed #642, avoid “freezing” when calling CONS on non-list/null
...
Diffstat (limited to 'morphic.js')
| -rw-r--r-- | morphic.js | 37 |
1 files changed, 20 insertions, 17 deletions
@@ -464,9 +464,15 @@ MyMorph.prototype.mouseMove = function(pos) {}; - The only optional parameter of such a method is a Point object + All of these methods have as optional parameter a Point object indicating the current position of the Hand inside the World's - coordinate system. + coordinate system. The + + mouseMove(pos, button) + + event method has an additional optional parameter indicating the + currently pressed mouse button, which is either 'left' or 'right'. + You can use this to let users interact with 3D environments. Events may be "bubbled" up a morph's owner chain by calling @@ -1035,7 +1041,7 @@ /*global window, HTMLCanvasElement, getMinimumFontHeight, FileReader, Audio, FileList, getBlurredShadowSupport*/ -var morphicVersion = '2014-September-30'; +var morphicVersion = '2014-November-20'; var modules = {}; // keep track of additional loaded modules var useBlurredShadows = getBlurredShadowSupport(); // check for Chrome-bug @@ -5754,7 +5760,7 @@ SliderMorph.prototype.rangeSize = function () { }; SliderMorph.prototype.ratio = function () { - return this.size / this.rangeSize(); + return this.size / (this.rangeSize() + 1); }; SliderMorph.prototype.unitSize = function () { @@ -9346,11 +9352,11 @@ HandMorph.prototype.init = function (aWorld) { this.world = aWorld; this.mouseButton = null; this.mouseOverList = []; - this.mouseDownMorph = null; this.morphToGrab = null; this.grabOrigin = null; this.temporaries = []; this.touchHoldTimeout = null; + this.contextMenuEnabled = false; }; HandMorph.prototype.changed = function () { @@ -9494,9 +9500,10 @@ HandMorph.prototype.drop = function () { */ HandMorph.prototype.processMouseDown = function (event) { - var morph, expectedClick, actualClick; + var morph, actualClick; this.destroyTemporaries(); + this.contextMenuEnabled = true; this.morphToGrab = null; if (this.children.length !== 0) { this.drop(); @@ -9529,15 +9536,9 @@ HandMorph.prototype.processMouseDown = function (event) { if (event.button === 2 || event.ctrlKey) { this.mouseButton = 'right'; actualClick = 'mouseDownRight'; - expectedClick = 'mouseClickRight'; } else { this.mouseButton = 'left'; actualClick = 'mouseDownLeft'; - expectedClick = 'mouseClickLeft'; - } - this.mouseDownMorph = morph; - while (!this.mouseDownMorph[expectedClick]) { - this.mouseDownMorph = this.mouseDownMorph.parent; } while (!morph[actualClick]) { morph = morph.parent; @@ -9596,7 +9597,7 @@ HandMorph.prototype.processMouseUp = function () { expectedClick = 'mouseClickLeft'; } else { expectedClick = 'mouseClickRight'; - if (this.mouseButton) { + if (this.mouseButton && this.contextMenuEnabled) { context = morph; contextMenu = context.contextMenu(); while ((!contextMenu) && @@ -9654,16 +9655,18 @@ HandMorph.prototype.processMouseMove = function (event) { // mouseOverNew = this.allMorphsAtPointer(); mouseOverNew = this.morphAtPointer().allParents(); - if ((this.children.length === 0) && - (this.mouseButton === 'left')) { + if (!this.children.length && this.mouseButton) { topMorph = this.morphAtPointer(); morph = topMorph.rootForGrab(); if (topMorph.mouseMove) { - topMorph.mouseMove(pos); + topMorph.mouseMove(pos, this.mouseButton); + if (this.mouseButton === 'right') { + this.contextMenuEnabled = false; + } } // if a morph is marked for grabbing, just grab it - if (this.morphToGrab) { + if (this.mouseButton === 'left' && this.morphToGrab) { if (this.morphToGrab.isDraggable) { morph = this.morphToGrab; this.grab(morph); |
