Skip to content

Commit

Permalink
fix: 馃悰 should clear knob on forcused node changed
Browse files Browse the repository at this point in the history
  • Loading branch information
bubkoo committed Jan 5, 2021
1 parent 20cbae6 commit bf83cd8
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions packages/x6/src/graph/hook.ts
Expand Up @@ -147,6 +147,8 @@ export class Hook extends Base implements Hook.IHook {
...options,
...widgetOptions,
})
} if (options.clearAll) {
Transform.removeInstances(this.graph)
}

return null
Expand All @@ -159,6 +161,16 @@ export class Hook extends Base implements Hook.IHook {
node,
this.options.knob,
)

const localOptions = {
...options,
...widgetOptions,
}

if (localOptions.clearAll) {
Knob.removeInstances(this.graph)
}

const knob = node.prop('knob') as Knob.Metadata
if (knob) {
if (knob.enabled === false) {
Expand All @@ -171,14 +183,15 @@ export class Hook extends Base implements Hook.IHook {
) {
return null
}
} else {
return null
}

if (options.enabled) {
return new Knob({
node,
graph: this.graph,
...options,
...widgetOptions,
...localOptions,
})
}

Expand Down

0 comments on commit bf83cd8

Please sign in to comment.