Skip to content

Commit a2e2492

Browse files
committed
set the position correctly
1 parent ee42fa1 commit a2e2492

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/fields/field_flydown.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,16 @@ export class FieldFlydown extends Blockly.FieldTextInput {
259259
this.createFlydown_(mainWorkspace);
260260
}
261261
if (this.flydown_) {
262+
const fieldElement = this.getClickTarget_();
263+
264+
const fieldRect = fieldElement!.getBoundingClientRect();
265+
const workspaceRect = mainWorkspace.getParentSvg().getBoundingClientRect();
266+
267+
const x = fieldRect.right - workspaceRect.left;
268+
const y = fieldRect.top - workspaceRect.top;
269+
270+
// Set flydown position
271+
this.flydown_.setPosition(x, y);
262272
// Show the flydown with your blocks
263273
this.flydown_.show(this.getBlocksForFlydown_());
264274

0 commit comments

Comments
 (0)