fix: some svelte 5 issues
This commit is contained in:
@@ -25,10 +25,10 @@
|
||||
$effect(() => {
|
||||
appSettings.theme;
|
||||
strokeColor = isSelected
|
||||
? colors.selected.clone()
|
||||
? colors.selected
|
||||
: isActive
|
||||
? colors.active.clone()
|
||||
: colors.outline.clone();
|
||||
? colors.active
|
||||
: colors.outline;
|
||||
});
|
||||
|
||||
const updateNodePosition =
|
||||
|
@@ -8,8 +8,7 @@
|
||||
|
||||
type Props = {
|
||||
node: Node;
|
||||
|
||||
position?: "absolute" | "fixed";
|
||||
position?: "absolute" | "fixed" | "relative";
|
||||
isActive?: boolean;
|
||||
isSelected?: boolean;
|
||||
inView?: boolean;
|
||||
@@ -17,7 +16,7 @@
|
||||
};
|
||||
|
||||
let {
|
||||
node,
|
||||
node = $bindable(),
|
||||
position = "absolute",
|
||||
isActive = false,
|
||||
isSelected = false,
|
||||
|
@@ -19,8 +19,19 @@
|
||||
|
||||
const graph = getGraphManager();
|
||||
|
||||
let value = $state(node?.props?.[id] ?? input.value);
|
||||
function getDefaultValue() {
|
||||
if (node?.props?.[id] !== undefined) return node?.props?.[id] as number;
|
||||
if ("value" in input && input?.value !== undefined)
|
||||
return input?.value as number;
|
||||
if (input.type === "boolean") return 0;
|
||||
if (input.type === "float") return 0.5;
|
||||
if (input.type === "integer") return 0;
|
||||
if (input.type === "select") return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
let value = $state(getDefaultValue());
|
||||
$inspect({ nodeId: node.type, id, value });
|
||||
$effect(() => {
|
||||
if (value !== undefined && node?.props?.[id] !== value) {
|
||||
node.props = { ...node.props, [id]: value };
|
||||
|
Reference in New Issue
Block a user