Basic z ordering

This commit is contained in:
Steve Ruiz 2021-05-23 14:46:04 +01:00
parent 6582eb990c
commit f11c35e941
20 changed files with 468 additions and 516 deletions

View file

@ -56,6 +56,10 @@ const MainSVG = styled("svg", {
height: "100%",
touchAction: "none",
zIndex: 100,
"& *": {
userSelect: "none",
},
})
const MainGroup = styled("g", {})

View file

@ -9,10 +9,11 @@ here; and still cheaper than any other pattern I've found.
*/
export default function Page() {
const currentPageShapeIds = useSelector(
({ data }) => Object.keys(getPage(data).shapes),
deepCompareArrays
)
const currentPageShapeIds = useSelector(({ data }) => {
return Object.values(getPage(data).shapes)
.sort((a, b) => a.childIndex - b.childIndex)
.map((shape) => shape.id)
}, deepCompareArrays)
return (
<>

View file

@ -1,8 +1,8 @@
import React, { useCallback, useRef, memo } from "react"
import state, { useSelector } from "state"
import inputs from "state/inputs"
import { getShapeUtils } from "lib/shape-utils"
import styled from "styles"
import { getShapeUtils } from "lib/shape-utils"
import { getPage } from "utils/utils"
function Shape({ id }: { id: string }) {