mirror of
https://github.com/google/blockly.git
synced 2026-01-07 00:50:27 +01:00
chore: remove need for dragBlockSelector
This commit is contained in:
@@ -1214,6 +1214,8 @@ export abstract class Flyout extends DeleteArea implements IFlyout {
|
|||||||
|
|
||||||
// Clone the block.
|
// Clone the block.
|
||||||
const json = blocks.save(oldBlock) as blocks.State;
|
const json = blocks.save(oldBlock) as blocks.State;
|
||||||
|
// TODO: Add a saveIds parameter to `save`.
|
||||||
|
json['id'] = undefined;
|
||||||
// Normallly this resizes leading to weird jumps. Save it for terminateDrag.
|
// Normallly this resizes leading to weird jumps. Save it for terminateDrag.
|
||||||
targetWorkspace.setResizesEnabled(false);
|
targetWorkspace.setResizesEnabled(false);
|
||||||
const block = blocks.append(json, targetWorkspace) as BlockSvg;
|
const block = blocks.append(json, targetWorkspace) as BlockSvg;
|
||||||
|
|||||||
@@ -61,13 +61,6 @@ async function testMutator(browser, delta) {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
// The flyout block and the workspace block have the same id, so to get
|
|
||||||
// around that I pass in the selector to the connect function.
|
|
||||||
const dragBlockSelector = await browser.$(
|
|
||||||
'#blocklyDiv > div > svg.blocklySvg > g > g.blocklyBubbleCanvas > g > ' +
|
|
||||||
'g:nth-child(2) > svg:nth-child(1) > g > g.blocklyBlockCanvas > ' +
|
|
||||||
'g.blocklyDraggable',
|
|
||||||
);
|
|
||||||
// For some reason this needs a lot more time.
|
// For some reason this needs a lot more time.
|
||||||
await browser.pause(2000);
|
await browser.pause(2000);
|
||||||
await connect(
|
await connect(
|
||||||
@@ -77,7 +70,6 @@ async function testMutator(browser, delta) {
|
|||||||
await getBlockElementById(browser, ifQuarkId),
|
await getBlockElementById(browser, ifQuarkId),
|
||||||
'NEXT',
|
'NEXT',
|
||||||
mutatorBlockId,
|
mutatorBlockId,
|
||||||
dragBlockSelector,
|
|
||||||
);
|
);
|
||||||
await browser.pause(PAUSE_TIME);
|
await browser.pause(PAUSE_TIME);
|
||||||
|
|
||||||
|
|||||||
@@ -305,7 +305,6 @@ async function connect(
|
|||||||
targetBlock,
|
targetBlock,
|
||||||
targetConnection,
|
targetConnection,
|
||||||
mutatorBlockId,
|
mutatorBlockId,
|
||||||
dragBlockSelector,
|
|
||||||
) {
|
) {
|
||||||
let draggedLocation;
|
let draggedLocation;
|
||||||
let targetLocation;
|
let targetLocation;
|
||||||
@@ -340,11 +339,7 @@ async function connect(
|
|||||||
x: targetLocation.x - draggedLocation.x,
|
x: targetLocation.x - draggedLocation.x,
|
||||||
y: targetLocation.y - draggedLocation.y,
|
y: targetLocation.y - draggedLocation.y,
|
||||||
};
|
};
|
||||||
if (mutatorBlockId) {
|
|
||||||
await dragBlockSelector.dragAndDrop(delta);
|
|
||||||
} else {
|
|
||||||
await draggedBlock.dragAndDrop(delta);
|
await draggedBlock.dragAndDrop(delta);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user