Don't try to zoom flyouts and mutators (#2772)

* Don't try to zoom flyouts and mutators

Fixes #2752

Flyouts and mutator workspaces don't have enough info to handle
zooming correctly, so they were throwing errors if you pinched them.
This adds a check to quit a zoom early if in either of those. We
might want to revisit later if we should support zooming on them.

* Add TODO
This commit is contained in:
RoboErikG
2019-08-06 13:05:01 -07:00
committed by GitHub
parent 9e4e909baa
commit dac4ae2e78

View File

@@ -1690,6 +1690,12 @@ Blockly.WorkspaceSvg.prototype.setBrowserFocus = function() {
* amount values zoom in.
*/
Blockly.WorkspaceSvg.prototype.zoom = function(x, y, amount) {
// TODO (#2782): Consider removing once pinch understands zoom configuration
// Mutators and flyouts don't support zooming, and pinch doesn't understand
// that.
if (this.isFlyout || this.isMutator) {
return;
}
// Scale factor.
var speed = this.options.zoomOptions.scaleSpeed;
var scaleChange = Math.pow(speed, amount);