mirror of
https://github.com/google/blockly.git
synced 2026-01-08 01:20:12 +01:00
Reflow flyouts when zoom level changes to keep block zoom level in sync.
This commit is contained in:
@@ -296,6 +296,9 @@ Blockly.Flyout.prototype.init = function(targetWorkspace) {
|
||||
this.targetWorkspace.addChangeListener(this.filterWrapper_);
|
||||
}
|
||||
|
||||
var zoomHandler = this.handleZoom_.bind(this);
|
||||
this.targetWorkspace.addChangeListener(zoomHandler);
|
||||
|
||||
// Dragging the flyout up and down.
|
||||
Array.prototype.push.apply(
|
||||
this.eventWrappers_,
|
||||
@@ -960,6 +963,19 @@ Blockly.Flyout.prototype.filterForCapacity_ = function() {
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Responds to workplace zoom events by reflowing the flyout to ensure that
|
||||
* blocks in the flyout adjust to the new zoom level.
|
||||
* @param {!Blockly.Events.Abstract} event The Blockly event that was fired.
|
||||
* @private
|
||||
*/
|
||||
Blockly.Flyout.prototype.handleZoom_ = function(event) {
|
||||
if (event.type === Blockly.Events.CLICK &&
|
||||
event.targetType === 'zoom_controls') {
|
||||
this.reflow();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Reflow blocks and their mats.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user