Closed deepkolos closed 1 year ago
Thanks, is it possible for you to carry out some refactoring?
SocketView
can be decoupled from NodeView
, as it requires only this.nodeView.el
. Also, offset calculation can be moved to a separate module
@Ni55aN code refactored
build errors
src/view/node.ts:58:76 - error TS2554: Expected 5 arguments, but got 6.
58 this.sockets.set(io, new SocketView(el, type, io, this.node, this, this.el));
~~~~~~~
src/view/node.ts:74:35 - error TS2345: Argument of type 'Node' is not assignable to parameter of type '{ position: number[]; el: HTMLElement; }'.
Property 'el' is missing in type 'Node' but required in type '{ position: number[]; el: HTMLElement; }'.
74 return socket.getPosition(this.node);
~~~~~~~~~
src/view/socket.ts:24:69
24 getPosition({ position, el: nodeViewEl }: { position: number[], el: HTMLElement }): [number, number] {
~~
'el' is declared here.
@Ni55aN fixed
🙆♂️
@deepkolos thanks for contributing!
when socket within complex layout, it's offsetParent is not NodeView.el, it have to collect offsets until NodeView.el
fix before
fix after