mirror of
https://github.com/scratchfoundation/scratch-blocks.git
synced 2025-08-28 22:10:31 -04:00
Stack glow proportional to scale (#615)
This commit is contained in:
parent
3ed6f33815
commit
4bbfa87b05
2 changed files with 15 additions and 1 deletions
|
@ -115,7 +115,7 @@ Blockly.createDom_ = function(container, options) {
|
|||
var stackGlowFilter = Blockly.createSvgElement('filter',
|
||||
{'id': 'blocklyStackGlowFilter',
|
||||
'height': '160%', 'width': '180%', y: '-30%', x: '-40%'}, defs);
|
||||
Blockly.createSvgElement('feGaussianBlur',
|
||||
options.stackGlowBlur = Blockly.createSvgElement('feGaussianBlur',
|
||||
{'in': 'SourceGraphic',
|
||||
'stdDeviation': Blockly.STACK_GLOW_RADIUS}, stackGlowFilter);
|
||||
// Set all gaussian blur pixels to 1 opacity before applying flood
|
||||
|
|
|
@ -297,6 +297,7 @@ Blockly.WorkspaceSvg.prototype.createDom = function(opt_backgroundClass) {
|
|||
this.addFlyout_();
|
||||
}
|
||||
this.updateGridPattern_();
|
||||
this.updateStackGlowScale_();
|
||||
this.recordDeleteAreas();
|
||||
return this.svgGroup_;
|
||||
};
|
||||
|
@ -1371,6 +1372,7 @@ Blockly.WorkspaceSvg.prototype.setScale = function(newScale) {
|
|||
newScale = this.options.zoomOptions.minScale;
|
||||
}
|
||||
this.scale = newScale;
|
||||
this.updateStackGlowScale_();
|
||||
this.updateGridPattern_();
|
||||
// Hide the WidgetDiv without animation (zoom makes field out of place with div)
|
||||
Blockly.WidgetDiv.hide(true);
|
||||
|
@ -1446,6 +1448,18 @@ Blockly.WorkspaceSvg.prototype.updateGridPattern_ = function() {
|
|||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Update the workspace's stack glow radius to be proportional to scale.
|
||||
* Ensures that stack glows always appear to be a fixed size.
|
||||
*/
|
||||
Blockly.WorkspaceSvg.prototype.updateStackGlowScale_ = function() {
|
||||
// No such def in the flyout workspace.
|
||||
if (this.options.stackGlowBlur) {
|
||||
this.options.stackGlowBlur.setAttribute('stdDeviation',
|
||||
Blockly.STACK_GLOW_RADIUS / this.scale
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Return an object with all the metrics required to size scrollbars for a
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue