Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
LiveDuo committed Nov 8, 2023
1 parent 377ca5f commit 5327a5e
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions lib/client/vanilla/editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -209,19 +209,18 @@ function Editor({ standaloneServer = false }) {
}

const onCanvasMouseOver = () => {
const components = getComponents()
components.forEach((c) => {
if (c.matches(':hover')) {
if (!c.isEqualNode(hoveredComponent)) {
setHoveredComponent(c)
if (!popoverRef.current) return

if (!popoverRef.current) return
const rect = getElementPosition(c)
popoverRef.current.style.top = `${rect.top}px`
popoverRef.current.style.left = `${rect.left}px`
}
}
})
// get hovered component
const components = getComponents()
const component = components.find((c) => c.matches(':hover'))!
if (!component) return

// update hovered component
setHoveredComponent(component)
const rect = getElementPosition(component)
popoverRef.current.style.top = `${rect.top}px`
popoverRef.current.style.left = `${rect.left}px`
}

const onCanvasMouseLeave = () => {
Expand Down

0 comments on commit 5327a5e

Please sign in to comment.