Merge branch 'main' into chore/svelte-typed-context
This commit is contained in:
@@ -1,5 +1,18 @@
|
||||
# @xyflow/svelte
|
||||
|
||||
## 1.4.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#5603](https://github.com/xyflow/xyflow/pull/5603) [`17a175791`](https://github.com/xyflow/xyflow/commit/17a175791b2420b32d55a8fcbbb35649862b85cf) Thanks [@peterkogo](https://github.com/peterkogo)! - Fix onPaneClick always firing when moving the viewport
|
||||
|
||||
- [#5615](https://github.com/xyflow/xyflow/pull/5615) [`8b35c77eb`](https://github.com/xyflow/xyflow/commit/8b35c77ebe5a4f6cba33c597d94eba1ead64fdfc) Thanks [@peterkogo](https://github.com/peterkogo)! - Fix wrong positions when resizing nodes with a non-default node-origin
|
||||
|
||||
- [#5578](https://github.com/xyflow/xyflow/pull/5578) [`00bcb9f5f`](https://github.com/xyflow/xyflow/commit/00bcb9f5f45f49814b9ac19b3f55cfe069ee3773) Thanks [@peterkogo](https://github.com/peterkogo)! - Pass current pointer position to connection
|
||||
|
||||
- Updated dependencies [[`00bcb9f5f`](https://github.com/xyflow/xyflow/commit/00bcb9f5f45f49814b9ac19b3f55cfe069ee3773)]:
|
||||
- @xyflow/system@0.0.73
|
||||
|
||||
## 1.4.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@xyflow/svelte",
|
||||
"version": "1.4.1",
|
||||
"version": "1.4.2",
|
||||
"description": "Svelte Flow - A highly customizable Svelte library for building node-based editors, workflow systems, diagrams and more.",
|
||||
"keywords": [
|
||||
"svelte",
|
||||
|
||||
@@ -61,7 +61,7 @@
|
||||
panOnScroll = false,
|
||||
panOnScrollSpeed = 0.5,
|
||||
panOnDrag = true,
|
||||
selectionOnDrag = true,
|
||||
selectionOnDrag = false,
|
||||
connectionLineComponent,
|
||||
connectionLineStyle,
|
||||
connectionLineContainerStyle,
|
||||
|
||||
@@ -75,14 +75,11 @@
|
||||
},
|
||||
onChange: (change: XYResizerChange, childChanges: XYResizerChildChange[]) => {
|
||||
// eslint-disable-next-line svelte/prefer-svelte-reactivity
|
||||
const changes = new Map<string, Partial<Node>>();
|
||||
let position = change.x && change.y ? { x: change.x, y: change.y } : undefined;
|
||||
changes.set(id, { ...change, position });
|
||||
const changes = new Map<string, XYResizerChange>();
|
||||
changes.set(id, change);
|
||||
|
||||
for (const childChange of childChanges) {
|
||||
changes.set(childChange.id, {
|
||||
position: childChange.position
|
||||
});
|
||||
changes.set(childChange.id, {x: childChange.position.x, y: childChange.position.y });
|
||||
}
|
||||
|
||||
store.nodes = store.nodes.map((node) => {
|
||||
@@ -91,11 +88,11 @@
|
||||
const vertical = !resizeDirection || resizeDirection === 'vertical';
|
||||
|
||||
if (change) {
|
||||
return {
|
||||
return {
|
||||
...node,
|
||||
position: {
|
||||
x: horizontal ? (change.position?.x ?? node.position.x) : node.position.x,
|
||||
y: vertical ? (change.position?.y ?? node.position.y) : node.position.y
|
||||
x: horizontal ? (change.x ?? node.position.x) : node.position.x,
|
||||
y: vertical ? (change.y ?? node.position.y) : node.position.y
|
||||
},
|
||||
width: horizontal ? (change.width ?? node.width) : node.width,
|
||||
height: vertical ? (change.height ?? node.height) : node.height
|
||||
|
||||
@@ -15,7 +15,9 @@ import {
|
||||
updateAbsolutePositions,
|
||||
snapPosition,
|
||||
calculateNodePosition,
|
||||
type SetCenterOptions
|
||||
type SetCenterOptions,
|
||||
getHandlePosition,
|
||||
Position
|
||||
} from '@xyflow/system';
|
||||
|
||||
import type { EdgeTypes, NodeTypes, Node, Edge, FitViewOptions } from '$lib/types';
|
||||
@@ -51,6 +53,15 @@ export function createStore<NodeType extends Node = Node, EdgeType extends Edge
|
||||
|
||||
const updateNodePositions: UpdateNodePositions = (nodeDragItems, dragging = false) => {
|
||||
store.nodes = store.nodes.map((node) => {
|
||||
if (store.connection.inProgress && store.connection.fromNode.id === node.id) {
|
||||
const internalNode = store.nodeLookup.get(node.id);
|
||||
if (internalNode) {
|
||||
store.connection = {
|
||||
...store.connection,
|
||||
from: getHandlePosition(internalNode, store.connection.fromHandle, Position.Left, true)
|
||||
};
|
||||
}
|
||||
}
|
||||
const dragItem = nodeDragItems.get(node.id);
|
||||
return dragItem ? { ...node, position: dragItem.position, dragging } : node;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user