diff --git a/HISTORY.md b/HISTORY.md index e7b8d975..5a3fa653 100755 --- a/HISTORY.md +++ b/HISTORY.md @@ -25,6 +25,7 @@ * gui: accelerated unified palette scrolling animation * adjust scroll bars when refreshing the palette * store: commented out saving the unified palette setting in the project xml during development +* morphic: optimized Morph >> scrollIntoView() ### 2021-07-07 * morphic, gui: tweaked perish() animation diff --git a/snap.html b/snap.html index b3b2c6fb..9319a79f 100755 --- a/snap.html +++ b/snap.html @@ -5,7 +5,7 @@ Snap! 7 - dev - Build Your Own Blocks - + diff --git a/src/morphic.js b/src/morphic.js index b80c5dae..aa4080b2 100644 --- a/src/morphic.js +++ b/src/morphic.js @@ -1291,7 +1291,7 @@ /*jshint esversion: 6*/ -var morphicVersion = '2021-July-07'; +var morphicVersion = '2021-July-08'; var modules = {}; // keep track of additional loaded modules var useBlurredShadows = true; @@ -3422,24 +3422,26 @@ Morph.prototype.keepWithin = function (aMorph) { Morph.prototype.scrollIntoView = function () { var leftOff, rightOff, topOff, bottomOff, - sf = this.parentThatIsA(ScrollFrameMorph); + sf = this.parentThatIsA(ScrollFrameMorph), + fb; if (!sf) {return; } + fb = this.fullBounds(); rightOff = Math.min( - this.fullBounds().right() - sf.right(), + fb.right() - sf.right(), sf.contents.right() - sf.right() ); if (rightOff > 0) { sf.contents.moveBy(new Point(-rightOff, 0)); } - leftOff = this.fullBounds().left() - sf.left(); + leftOff = fb.left() - sf.left(); if (leftOff < 0) { sf.contents.moveBy(new Point(-leftOff, 0)); } - topOff = this.fullBounds().top() - sf.top(); + topOff = fb.top() - sf.top(); if (topOff < 0) { sf.contents.moveBy(new Point(0, -topOff)); } - bottomOff = this.fullBounds().bottom() - sf.bottom(); + bottomOff = fb.bottom() - sf.bottom(); if (bottomOff > 0) { sf.contents.moveBy(new Point(0, -bottomOff)); }