Merge pull request #540 from picklesrus/develop-mutator-coord

Fix for #521.
This commit is contained in:
rachel-fenichel
2016-08-16 11:49:11 -07:00
committed by GitHub
4 changed files with 17 additions and 0 deletions

View File

@@ -127,6 +127,9 @@ Blockly.Block = function(workspace, prototypeName, opt_id) {
this.workspace = workspace;
/** @type {boolean} */
this.isInFlyout = workspace.isFlyout;
/** @type {boolean} */
this.isInMutator = workspace.isMutator;
/** @type {boolean} */
this.RTL = workspace.RTL;

View File

@@ -533,6 +533,12 @@ Blockly.BlockSvg.prototype.onMouseDown_ = function(e) {
if (this.isInFlyout) {
return;
}
if (this.isInMutator) {
// Mutator's coordinate system could be out of date because the bubble was
// dragged, the block was moved, the parent workspace zoomed, etc.
this.workspace.resize();
}
this.workspace.updateScreenCalculationsIfScrolled();
this.workspace.markFocused();
Blockly.terminateDrag_();

View File

@@ -129,6 +129,7 @@ Blockly.Mutator.prototype.createEditor_ = function() {
setMetrics: null
};
this.workspace_ = new Blockly.WorkspaceSvg(workspaceOptions);
this.workspace_.isMutator = true;
this.svgDialog_.appendChild(
this.workspace_.createDom('blocklyMutatorBackground'));
return this.svgDialog_;

View File

@@ -82,6 +82,13 @@ Blockly.WorkspaceSvg.prototype.rendered = true;
*/
Blockly.WorkspaceSvg.prototype.isFlyout = false;
/**
* Is this workspace the surface for a mutator?
* @type {boolean}
* @package
*/
Blockly.WorkspaceSvg.prototype.isMutator = false;
/**
* Is this workspace currently being dragged around?
* DRAG_NONE - No drag operation.