mirror of
https://github.com/scratchfoundation/scratch-blocks.git
synced 2025-08-28 22:10:31 -04:00
Cache result of getMetrics
This commit is contained in:
parent
d71c0e01d1
commit
53101f763f
2 changed files with 6 additions and 4 deletions
|
@ -253,8 +253,9 @@ Blockly.HorizontalFlyout.prototype.scrollTo = function(pos) {
|
|||
|
||||
// Make sure not to set the scroll target past the farthest point we can
|
||||
// scroll to, i.e. the content width minus the view width
|
||||
var contentWidth = this.workspace_.getMetrics().contentWidth;
|
||||
var viewWidth = this.workspace_.getMetrics().viewWidth;
|
||||
var metrics = this.workspace_.getMetrics();
|
||||
var contentWidth = metrics.contentWidth;
|
||||
var viewWidth = metrics.viewWidth;
|
||||
this.scrollTarget = Math.min(this.scrollTarget, contentWidth - viewWidth);
|
||||
|
||||
this.step();
|
||||
|
|
|
@ -341,8 +341,9 @@ Blockly.VerticalFlyout.prototype.scrollTo = function(pos) {
|
|||
|
||||
// Make sure not to set the scroll target below the lowest point we can
|
||||
// scroll to, i.e. the content height minus the view height
|
||||
var contentHeight = this.workspace_.getMetrics().contentHeight;
|
||||
var viewHeight = this.workspace_.getMetrics().viewHeight;
|
||||
var metrics = this.workspace_.getMetrics();
|
||||
var contentHeight = metrics.contentHeight;
|
||||
var viewHeight = metrics.viewHeight;
|
||||
this.scrollTarget = Math.min(this.scrollTarget, contentHeight - viewHeight);
|
||||
|
||||
this.step();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue