react-zdog
Advanced tools
Comparing version 1.2.0 to 1.2.1
@@ -191,31 +191,29 @@ 'use strict'; | ||
React.useLayoutEffect(function () { | ||
if (parent) { | ||
parent.addChild(node); | ||
if (!parent) return; | ||
parent.addChild(node); | ||
state.current.illu.updateGraph(); | ||
return function () { | ||
parent.removeChild(node); | ||
parent.updateFlatGraph(); | ||
state.current.illu.updateGraph(); | ||
return function () { | ||
parent.removeChild(node); | ||
parent.updateFlatGraph(); | ||
state.current.illu.updateGraph(); | ||
}; | ||
} | ||
}; | ||
}, [parent]); | ||
React.useEffect(function () { | ||
if (parent) { | ||
state.current.itemMap[colorId] = node; | ||
if (!parent) return; | ||
state.current.itemMap[colorId] = node; | ||
if (props.onClick) { | ||
state.current.clickEventMap[colorId] = props.onClick; | ||
} | ||
if (props.onClick) { | ||
state.current.clickEventMap[colorId] = props.onClick; | ||
} | ||
if (props.onPointerMove) { | ||
state.current.pointerMoveEventMap[colorId] = props.onPointerMove; | ||
} | ||
if (props.onPointerMove) { | ||
state.current.pointerMoveEventMap[colorId] = props.onPointerMove; | ||
} | ||
if (props.onPointerEnter) { | ||
state.current.pointerEnterEventMap[colorId] = props.onPointerEnter; | ||
} | ||
if (props.onPointerEnter) { | ||
state.current.pointerEnterEventMap[colorId] = props.onPointerEnter; | ||
} | ||
if (props.onPointerLeave) { | ||
state.current.pointerLeaveEventMap[colorId] = props.onPointerLeave; | ||
} | ||
if (props.onPointerLeave) { | ||
state.current.pointerLeaveEventMap[colorId] = props.onPointerLeave; | ||
} | ||
@@ -232,11 +230,10 @@ | ||
React.useLayoutEffect(function () { | ||
if (ghostParent) { | ||
ghostParent.addChild(ghost_node); | ||
if (!ghostParent) return; | ||
ghostParent.addChild(ghost_node); | ||
state.current.illu_ghost.updateGraph(); | ||
return function () { | ||
ghostParent.removeChild(ghost_node); | ||
ghostParent.updateFlatGraph(); | ||
state.current.illu_ghost.updateGraph(); | ||
return function () { | ||
ghostParent.removeChild(ghost_node); | ||
ghostParent.updateFlatGraph(); | ||
state.current.illu_ghost.updateGraph(); | ||
}; | ||
} | ||
}; | ||
}, [ghostParent]); | ||
@@ -243,0 +240,0 @@ return [React__default.createElement(ghostParentContext.Provider, { |
@@ -168,31 +168,29 @@ import Zdog from 'zdog'; | ||
useLayoutEffect(() => { | ||
if (parent) { | ||
parent.addChild(node); | ||
if (!parent) return; | ||
parent.addChild(node); | ||
state.current.illu.updateGraph(); | ||
return () => { | ||
parent.removeChild(node); | ||
parent.updateFlatGraph(); | ||
state.current.illu.updateGraph(); | ||
return () => { | ||
parent.removeChild(node); | ||
parent.updateFlatGraph(); | ||
state.current.illu.updateGraph(); | ||
}; | ||
} | ||
}; | ||
}, [parent]); | ||
useEffect(() => { | ||
if (parent) { | ||
state.current.itemMap[colorId] = node; | ||
if (!parent) return; | ||
state.current.itemMap[colorId] = node; | ||
if (props.onClick) { | ||
state.current.clickEventMap[colorId] = props.onClick; | ||
} | ||
if (props.onClick) { | ||
state.current.clickEventMap[colorId] = props.onClick; | ||
} | ||
if (props.onPointerMove) { | ||
state.current.pointerMoveEventMap[colorId] = props.onPointerMove; | ||
} | ||
if (props.onPointerMove) { | ||
state.current.pointerMoveEventMap[colorId] = props.onPointerMove; | ||
} | ||
if (props.onPointerEnter) { | ||
state.current.pointerEnterEventMap[colorId] = props.onPointerEnter; | ||
} | ||
if (props.onPointerEnter) { | ||
state.current.pointerEnterEventMap[colorId] = props.onPointerEnter; | ||
} | ||
if (props.onPointerLeave) { | ||
state.current.pointerLeaveEventMap[colorId] = props.onPointerLeave; | ||
} | ||
if (props.onPointerLeave) { | ||
state.current.pointerLeaveEventMap[colorId] = props.onPointerLeave; | ||
} | ||
@@ -209,11 +207,10 @@ | ||
useLayoutEffect(() => { | ||
if (ghostParent) { | ||
ghostParent.addChild(ghost_node); | ||
if (!ghostParent) return; | ||
ghostParent.addChild(ghost_node); | ||
state.current.illu_ghost.updateGraph(); | ||
return () => { | ||
ghostParent.removeChild(ghost_node); | ||
ghostParent.updateFlatGraph(); | ||
state.current.illu_ghost.updateGraph(); | ||
return () => { | ||
ghostParent.removeChild(ghost_node); | ||
ghostParent.updateFlatGraph(); | ||
state.current.illu_ghost.updateGraph(); | ||
}; | ||
} | ||
}; | ||
}, [ghostParent]); | ||
@@ -220,0 +217,0 @@ return [React.createElement(ghostParentContext.Provider, { |
{ | ||
"name": "react-zdog", | ||
"version": "1.2.0", | ||
"version": "1.2.1", | ||
"description": "React-fiber renderer for zdog", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.cjs.js", |
@@ -93,10 +93,11 @@ import React, { | ||
useLayoutEffect(() => { | ||
if (parent) { | ||
parent.addChild(node) | ||
if (!parent) return | ||
parent.addChild(node) | ||
state.current.illu.updateGraph() | ||
return () => { | ||
parent.removeChild(node) | ||
parent.updateFlatGraph() | ||
state.current.illu.updateGraph() | ||
return () => { | ||
parent.removeChild(node) | ||
parent.updateFlatGraph() | ||
state.current.illu.updateGraph() | ||
} | ||
} | ||
@@ -106,17 +107,17 @@ }, [parent]) | ||
useEffect(() => { | ||
if (parent) { | ||
state.current.itemMap[colorId] = node | ||
if (props.onClick) { | ||
state.current.clickEventMap[colorId] = props.onClick | ||
} | ||
if (props.onPointerMove) { | ||
state.current.pointerMoveEventMap[colorId] = props.onPointerMove | ||
} | ||
if (props.onPointerEnter) { | ||
state.current.pointerEnterEventMap[colorId] = props.onPointerEnter | ||
} | ||
if (props.onPointerLeave) { | ||
state.current.pointerLeaveEventMap[colorId] = props.onPointerLeave | ||
} | ||
if (!parent) return | ||
state.current.itemMap[colorId] = node | ||
if (props.onClick) { | ||
state.current.clickEventMap[colorId] = props.onClick | ||
} | ||
if (props.onPointerMove) { | ||
state.current.pointerMoveEventMap[colorId] = props.onPointerMove | ||
} | ||
if (props.onPointerEnter) { | ||
state.current.pointerEnterEventMap[colorId] = props.onPointerEnter | ||
} | ||
if (props.onPointerLeave) { | ||
state.current.pointerLeaveEventMap[colorId] = props.onPointerLeave | ||
} | ||
@@ -133,10 +134,11 @@ return () => { | ||
useLayoutEffect(() => { | ||
if (ghostParent) { | ||
ghostParent.addChild(ghost_node) | ||
if (!ghostParent) return | ||
ghostParent.addChild(ghost_node) | ||
state.current.illu_ghost.updateGraph() | ||
return () => { | ||
ghostParent.removeChild(ghost_node) | ||
ghostParent.updateFlatGraph() | ||
state.current.illu_ghost.updateGraph() | ||
return () => { | ||
ghostParent.removeChild(ghost_node) | ||
ghostParent.updateFlatGraph() | ||
state.current.illu_ghost.updateGraph() | ||
} | ||
} | ||
@@ -143,0 +145,0 @@ }, [ghostParent]) |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
0
50350
1300