Skip to content

Commit

Permalink
Update morphic.js
Browse files Browse the repository at this point in the history
fixed Pen demo and "doIt" for inspectors
  • Loading branch information
jmoenig committed Jan 21, 2025
1 parent ea18e51 commit 0449991
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions morphic.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
written by Jens Mönig
[email protected]
Copyright (C) 2010-2024 by Jens Mönig
Copyright (C) 2010-2025 by Jens Mönig
This file is part of Snap!.
Expand Down Expand Up @@ -1338,7 +1338,7 @@

/*jshint esversion: 11, bitwise: false*/

var morphicVersion = '2024-October-09';
var morphicVersion = '2025-January-21';
var modules = {}; // keep track of additional loaded modules
var useBlurredShadows = true;

Expand Down Expand Up @@ -3122,6 +3122,16 @@ Node.prototype.allChildren = function () {
return result;
};

Node.prototype.allChildrenExcept = function (callback) {
// includes myself, stops at nodes that satisfy the callback predicate
var result = [this];
if (callback(this)) {return []; }
this.children.forEach(child => {
result = result.concat(child.allChildrenExcept(callback));
});
return result;
};

Node.prototype.forAllChildren = function (aFunction) {
if (this.children.length > 0) {
this.children.forEach(child => child.forAllChildren(aFunction));
Expand Down Expand Up @@ -3869,6 +3879,7 @@ Morph.prototype.penTrails = function () {
// obtained canvas will be around at the next display cycle,
// so they might also wish to set the receiver's "isCachingImage"
// property to "true".
this.isCachingImage = true;
return this.getImage();
};

Expand Down Expand Up @@ -11502,7 +11513,9 @@ HandMorph.prototype.processMouseDown = function (event) {
}
}
if (this.world.cursor) {
if (morph !== this.world.cursor.target) {
if (morph !== this.world.cursor.target &&
!morph.parentThatIsA(MenuItemMorph)
) {
this.world.stopEditing();
}
}
Expand Down

0 comments on commit 0449991

Please sign in to comment.