Skip to content

Commit

Permalink
fix: find node
Browse files Browse the repository at this point in the history
  • Loading branch information
nonzzz committed Jan 20, 2025
1 parent 527419a commit c75f4c6
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
3 changes: 1 addition & 2 deletions dev/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,8 @@ async function main() {
treemap.init(root)

main().catch(console.error)

treemap.on('click', function(metadata) {
this.zoom(metadata.module)
// this.zoom(metadata.module)
})

new ResizeObserver(() => treemap.resize()).observe(root)
Expand Down
2 changes: 1 addition & 1 deletion src/etoile/native/dom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export function createEffectScope() {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export function bindDOMEvent(el: HTMLElement, evt: DOMEventType | (string & {}), dom: DOMEvent<any>) {
const handler = (e: unknown) => {
const { x, y } = captureBoxXY(el, e, dom.matrix.a, dom.matrix.d, dom.matrix.e, dom.matrix.f)
const { x, y } = captureBoxXY(el, e, 1, 1, dom.matrix.e, dom.matrix.f)
// @ts-expect-error safe
dom.emit(evt, { native: e, loc: { x, y } })
}
Expand Down
8 changes: 5 additions & 3 deletions src/primitives/event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ function drawHighlight(treemap: TreemapLayout, evt: TreemapEvent) {
highlight.add(mask)
highlight.setZIndexForHighlight('1')
applyForOpacity(mask, 0.4, 0.4, easedProgress)
stackMatrixTransform(mask, evt.matrix.e, evt.matrix.f, evt.matrix.a)
stackMatrixTransform(mask, evt.matrix.e, evt.matrix.f, 1)
highlight.update()
}, {
duration: ANIMATION_DURATION,
Expand Down Expand Up @@ -213,7 +213,7 @@ export class TreemapEvent extends DOMEvent {
if (this.state.currentNode !== node) {
this.state.currentNode = node
}
// drawHighlight(ctx.treemap, this)
drawHighlight(ctx.treemap, this)
} else {
// for drag
const { treemap } = ctx
Expand Down Expand Up @@ -404,7 +404,9 @@ function createOnZoom(treemap: TreemapLayout, evt: TreemapEvent) {
treemap.update()
}, {
duration: ANIMATION_DURATION,
onStop: () => evt.state.isZooming = false
onStop: () => {
evt.state.isZooming = false
}
})
}
root = node
Expand Down

0 comments on commit c75f4c6

Please sign in to comment.