mirror of
https://github.com/google/blockly.git
synced 2026-01-05 08:00:09 +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.
|
||||
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.
|
||||
targetWorkspace.setResizesEnabled(false);
|
||||
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.
|
||||
await browser.pause(2000);
|
||||
await connect(
|
||||
@@ -77,7 +70,6 @@ async function testMutator(browser, delta) {
|
||||
await getBlockElementById(browser, ifQuarkId),
|
||||
'NEXT',
|
||||
mutatorBlockId,
|
||||
dragBlockSelector,
|
||||
);
|
||||
await browser.pause(PAUSE_TIME);
|
||||
|
||||
|
||||
@@ -305,7 +305,6 @@ async function connect(
|
||||
targetBlock,
|
||||
targetConnection,
|
||||
mutatorBlockId,
|
||||
dragBlockSelector,
|
||||
) {
|
||||
let draggedLocation;
|
||||
let targetLocation;
|
||||
@@ -340,11 +339,7 @@ async function connect(
|
||||
x: targetLocation.x - draggedLocation.x,
|
||||
y: targetLocation.y - draggedLocation.y,
|
||||
};
|
||||
if (mutatorBlockId) {
|
||||
await dragBlockSelector.dragAndDrop(delta);
|
||||
} else {
|
||||
await draggedBlock.dragAndDrop(delta);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user