fix(label): selected path add point
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import paper from "paper"
|
||||
import { useLabelStore, useObjectStore } from "../store"
|
||||
import { useOtherToolsStore } from "../useOtherToolsStore"
|
||||
import { usePaperStore } from "../usePaperStore"
|
||||
import { ensureEditablePaperPathSelected, usePaperStore } from "../usePaperStore"
|
||||
import { usePaperSupportStore } from "../usePaperSupportStore"
|
||||
import { useTopToolsStore } from "../useTopToolsStore"
|
||||
|
||||
@@ -93,6 +93,13 @@ const applySelectedItemVisual = (item: paper.Item) => {
|
||||
if (!["rectangle", "polygon", "brush", "point"].includes(itemType || ""))
|
||||
return
|
||||
|
||||
const objectId = Number(item.data?.id)
|
||||
const editablePath = Number.isFinite(objectId)
|
||||
? ensureEditablePaperPathSelected(objectId)
|
||||
: item instanceof paper.Path && !item.data?.isHollowPolygon
|
||||
? item
|
||||
: null
|
||||
|
||||
if (itemType === "rectangle" && item instanceof paper.Path) {
|
||||
item.data.selected = true
|
||||
usePaperSupportStore.getState().handleBufferPaths(item)
|
||||
@@ -100,19 +107,25 @@ const applySelectedItemVisual = (item: paper.Item) => {
|
||||
item.fillColor = item.data.fillColor || item.fillColor || null
|
||||
} else if (itemType === "brush") {
|
||||
item.data.selected = true
|
||||
if (item instanceof paper.Path) {
|
||||
usePaperSupportStore.getState().handleMask(item)
|
||||
usePaperSupportStore.getState().handleBufferPaths(item)
|
||||
usePaperSupportStore.getState().handleCircles(item)
|
||||
if (editablePath) {
|
||||
usePaperSupportStore.getState().handleMask(editablePath)
|
||||
usePaperSupportStore.getState().handleBufferPaths(editablePath)
|
||||
usePaperSupportStore.getState().handleCircles(editablePath)
|
||||
}
|
||||
} else if (itemType === "point" && item instanceof paper.Path) {
|
||||
} else if (itemType === "point") {
|
||||
item.data.selected = true
|
||||
usePaperSupportStore.getState().handleMask(item)
|
||||
usePaperSupportStore.getState().handleText(item)
|
||||
usePaperSupportStore.getState().handleBufferPaths(item)
|
||||
usePaperSupportStore.getState().handleCircles(item)
|
||||
if (editablePath) {
|
||||
usePaperSupportStore.getState().handleMask(editablePath)
|
||||
usePaperSupportStore.getState().handleText(editablePath)
|
||||
usePaperSupportStore.getState().handleBufferPaths(editablePath)
|
||||
usePaperSupportStore.getState().handleCircles(editablePath)
|
||||
}
|
||||
} else if (itemType === "polygon") {
|
||||
item.data.selected = true
|
||||
if (editablePath) {
|
||||
usePaperSupportStore.getState().handleBufferPaths(editablePath)
|
||||
usePaperSupportStore.getState().handleCircles(editablePath)
|
||||
}
|
||||
if (!(item instanceof paper.Path) || !item.data?.isHollowPolygon) {
|
||||
item.fillColor = item.data.fillColor || item.fillColor || null
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user