fix(label): line width
This commit is contained in:
@@ -80,6 +80,7 @@ const replacePaperWorkingPolygonShape = (
|
|||||||
}
|
}
|
||||||
|
|
||||||
syncPaperCompoundPolygonChildrenData(nextShape, phase)
|
syncPaperCompoundPolygonChildrenData(nextShape, phase)
|
||||||
|
syncPaperObjectStrokeScaling(nextShape)
|
||||||
currentShape?.remove()
|
currentShape?.remove()
|
||||||
|
|
||||||
if (!nextShape.parent && originalParent && "insertChild" in originalParent) {
|
if (!nextShape.parent && originalParent && "insertChild" in originalParent) {
|
||||||
@@ -146,6 +147,7 @@ const createPaperPathFromGeometryContour = ({
|
|||||||
)
|
)
|
||||||
path.strokeColor = clonePaperColor(strokeColor)
|
path.strokeColor = clonePaperColor(strokeColor)
|
||||||
path.strokeWidth = strokeWidth
|
path.strokeWidth = strokeWidth
|
||||||
|
path.strokeScaling = false
|
||||||
path.fillColor = clonePaperColor(fillColor)
|
path.fillColor = clonePaperColor(fillColor)
|
||||||
path.visible = visible
|
path.visible = visible
|
||||||
path.opacity = opacity
|
path.opacity = opacity
|
||||||
@@ -215,6 +217,7 @@ const createPaperPolygonShapeFromGeometry = ({
|
|||||||
compoundPath.data = safeClone(baseData)
|
compoundPath.data = safeClone(baseData)
|
||||||
compoundPath.strokeColor = clonePaperColor(strokeColor)
|
compoundPath.strokeColor = clonePaperColor(strokeColor)
|
||||||
compoundPath.strokeWidth = strokeWidth
|
compoundPath.strokeWidth = strokeWidth
|
||||||
|
compoundPath.strokeScaling = false
|
||||||
compoundPath.fillColor = clonePaperColor(fillColor)
|
compoundPath.fillColor = clonePaperColor(fillColor)
|
||||||
compoundPath.visible = visible
|
compoundPath.visible = visible
|
||||||
compoundPath.opacity = opacity
|
compoundPath.opacity = opacity
|
||||||
@@ -899,6 +902,40 @@ const isPaperObjectType = (type: unknown) =>
|
|||||||
typeof type === "string" &&
|
typeof type === "string" &&
|
||||||
PAPER_OBJECT_TYPES.includes(type as (typeof PAPER_OBJECT_TYPES)[number])
|
PAPER_OBJECT_TYPES.includes(type as (typeof PAPER_OBJECT_TYPES)[number])
|
||||||
|
|
||||||
|
const syncPaperObjectStrokeScaling = (
|
||||||
|
item: paper.Item | null | undefined
|
||||||
|
) => {
|
||||||
|
if (!(item instanceof paper.Path || item instanceof paper.CompoundPath)) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (!isPaperObjectType(item.data?.type)) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
item.strokeScaling = false
|
||||||
|
|
||||||
|
if (item instanceof paper.CompoundPath) {
|
||||||
|
;(item.children as paper.Path[]).forEach((child) => {
|
||||||
|
child.strokeScaling = false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const syncAllPaperObjectStrokeScaling = () => {
|
||||||
|
const group = usePaperStore.getState().group
|
||||||
|
if (!group) return
|
||||||
|
|
||||||
|
group
|
||||||
|
.getItems({
|
||||||
|
match: (item: paper.Item) =>
|
||||||
|
(item instanceof paper.Path || item instanceof paper.CompoundPath) &&
|
||||||
|
isPaperObjectType(item.data?.type),
|
||||||
|
})
|
||||||
|
.forEach((item) => {
|
||||||
|
syncPaperObjectStrokeScaling(item)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
export const ensureEditablePaperPathSelected = (objectId: number) => {
|
export const ensureEditablePaperPathSelected = (objectId: number) => {
|
||||||
const objectPaths = usePaperStore
|
const objectPaths = usePaperStore
|
||||||
.getState()
|
.getState()
|
||||||
@@ -6887,6 +6924,8 @@ export const usePaperStore = create<PaperState>((set) => ({
|
|||||||
}
|
}
|
||||||
item.scale(1 / newScale)
|
item.scale(1 / newScale)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
syncAllPaperObjectStrokeScaling()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
getAll: () => {
|
getAll: () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user