mirror of
https://github.com/google/blockly.git
synced 2026-01-11 10:57:07 +01:00
Merge pull request #540 from picklesrus/develop-mutator-coord
Fix for #521.
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
@@ -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_();
|
||||
|
||||
@@ -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_;
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user