feat: performance upgrade (solves issue with nodes not being GC'd)

This commit is contained in:
Mark Mankarious 2023-10-09 15:18:12 +01:00
parent 2a9d10bf9b
commit bf42411d5e
6 changed files with 15 additions and 15 deletions

View file

@ -31,7 +31,9 @@ export const Grid = () => {
sx={{
position: 'absolute',
width: '100%',
height: '100%',
height: '100%'
}}
style={{
background: `repeat url("${gridTileSvg}")`,
backgroundSize: `${projectedTileSize.width}px`,
backgroundPosition: `calc(50% + ${

View file

@ -30,18 +30,20 @@ export const ConnectorLabel = ({ connector }: Props) => {
<Box
sx={{
position: 'absolute',
left: labelPosition.x,
top: labelPosition.y,
transform: `translate(-50%, -50%) scale(${zoom})`,
pointerEvents: 'none',
bgcolor: 'common.white',
border: 1,
py: 0.5,
px: 1,
borderRadius: 1,
maxWidth: projectedTileSize.width * (1 / zoom),
borderColor: 'grey.200'
}}
style={{
transform: `translate(-50%, -50%) scale(${zoom})`,
maxWidth: projectedTileSize.width * (1 / zoom),
left: labelPosition.x,
top: labelPosition.y
}}
>
<Typography color="text.secondary" variant="body2">
{connector.label}

View file

@ -85,7 +85,7 @@ export const Connector = ({ connector }: Props) => {
}, [connector.style, connectorWidthPx]);
return (
<Box sx={css}>
<Box style={css}>
<Svg
style={{
// TODO: The original x coordinates of each tile seems to be calculated wrongly.

View file

@ -34,13 +34,13 @@ export const Node = ({ node, order }: Props) => {
return (
<Box
sx={{
style={{
position: 'absolute',
zIndex: order
}}
>
<Box
sx={{
style={{
position: 'absolute',
left: position.x,
top: position.y
@ -53,7 +53,7 @@ export const Node = ({ node, order }: Props) => {
}}
>
<Box
sx={{
style={{
position: 'absolute',
top: -projectedTileSize.height
}}

View file

@ -11,11 +11,7 @@ export const Nodes = () => {
<>
{nodes.map((node) => {
return (
<Node
key={node.id}
order={-node.tile.x - node.tile.y}
node={node}
/>
<Node key={node.id} order={-node.tile.x - node.tile.y} node={node} />
);
})}
</>

View file

@ -26,7 +26,7 @@ export const TextBox = ({ textBox }: Props) => {
});
return (
<Box sx={css}>
<Box style={css}>
<Box
sx={{
position: 'absolute',