fix(canvas): repaint scene during live transforms
This commit is contained in:
parent
446ab8bc59
commit
6e413ccfa1
|
|
@ -93,8 +93,8 @@ export class LabelCache {
|
|||
graph: SceneGraph,
|
||||
viewport: Viewport
|
||||
): Array<{ node: SceneNode; absX: number; absY: number; inside: boolean }> {
|
||||
return collectVisibleLabels(graph, viewport, this.components, (cached) => ({
|
||||
inside: cached.parentType === 'COMPONENT_SET'
|
||||
return collectVisibleLabels(graph, viewport, this.components, () => ({
|
||||
inside: false
|
||||
}))
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -112,14 +112,14 @@ export function hitTestComponentLabel(
|
|||
|
||||
const LABEL_TYPES = new Set(['COMPONENT', 'COMPONENT_SET'])
|
||||
|
||||
return walkLabelTree(graph, pageId, (child, parent, ax, ay) => {
|
||||
return walkLabelTree(graph, pageId, (child, _parent, ax, ay) => {
|
||||
if (!LABEL_TYPES.has(child.type)) return undefined
|
||||
|
||||
const textW = measureGlyphWidth(font, child.name)
|
||||
const labelW = (COMPONENT_LABEL_ICON_SIZE + COMPONENT_LABEL_ICON_GAP + textW) / zoom
|
||||
const labelH = COMPONENT_LABEL_FONT_SIZE / zoom
|
||||
const gap = COMPONENT_LABEL_GAP / zoom
|
||||
const labelY = parent.type === 'COMPONENT_SET' ? ay + gap : ay - labelH - gap
|
||||
const labelY = ay - labelH - gap
|
||||
|
||||
return hitInRect(canvasX, canvasY, ax, labelY, labelW, labelH) ? child : undefined
|
||||
})
|
||||
|
|
|
|||
|
|
@ -46,10 +46,6 @@ function getRenderScheduler(editor: Editor): EditorRenderScheduler {
|
|||
return scheduler
|
||||
}
|
||||
|
||||
function shouldScheduleForRepaint(layer: CanvasRenderLayer | undefined) {
|
||||
return layer !== 'scene'
|
||||
}
|
||||
|
||||
function shouldScheduleForSelection(layer: CanvasRenderLayer | undefined) {
|
||||
return layer !== 'scene'
|
||||
}
|
||||
|
|
@ -92,9 +88,7 @@ export function createCanvasRenderLoop(
|
|||
editor.onEditorEvent('viewport:changed', scheduleRender)
|
||||
]
|
||||
|
||||
if (shouldScheduleForRepaint(options.layer)) {
|
||||
unsubscribe.push(editor.onEditorEvent('repaint:requested', scheduleRender))
|
||||
}
|
||||
unsubscribe.push(editor.onEditorEvent('repaint:requested', scheduleRender))
|
||||
|
||||
if (shouldScheduleForSelection(options.layer)) {
|
||||
unsubscribe.push(editor.onEditorEvent('selection:changed', scheduleRender))
|
||||
|
|
|
|||
Loading…
Reference in a new issue