chore(svelte/store): connection return early

This commit is contained in:
moklick
2025-06-16 14:29:02 +02:00
parent fe5b8c453f
commit 9df92206bb
@@ -341,18 +341,18 @@ export function getInitialStore<NodeType extends Node = Node, EdgeType extends E
_connection: ConnectionState = $state.raw(initialConnection); _connection: ConnectionState = $state.raw(initialConnection);
// We derive a viewport dependent connection here // We derive a viewport dependent connection here
connection: ConnectionState = $derived.by(() => { connection: ConnectionState = $derived.by(() => {
if (this._connection.inProgress) { if (!this._connection.inProgress) {
return {
...this._connection,
to: pointToRendererPoint(this._connection.to, [
this.viewport.x,
this.viewport.y,
this.viewport.zoom
])
};
} else {
return this._connection; return this._connection;
} }
return {
...this._connection,
to: pointToRendererPoint(this._connection.to, [
this.viewport.x,
this.viewport.y,
this.viewport.zoom
])
};
}); });
connectionMode: ConnectionMode = $derived( connectionMode: ConnectionMode = $derived(
signals.props.connectionMode ?? ConnectionMode.Strict signals.props.connectionMode ?? ConnectionMode.Strict