refactor(canvas): align overlay file layout
This commit is contained in:
parent
1c1753c4a0
commit
a23c75531a
|
|
@ -1,14 +1,9 @@
|
|||
import { existsSync } from 'node:fs'
|
||||
import path from 'node:path'
|
||||
|
||||
function normalizedFilename(context) {
|
||||
return (context.filename ?? context.getFilename?.() ?? '').replace(/\\/g, '/')
|
||||
}
|
||||
|
||||
function relativeFromRepo(file) {
|
||||
return path.relative(process.cwd(), file).replace(/\\/g, '/')
|
||||
}
|
||||
|
||||
function importSource(node) {
|
||||
return typeof node.source?.value === 'string' ? node.source.value : null
|
||||
}
|
||||
|
|
@ -1495,11 +1490,6 @@ const noDirectOpenPencilWindowInternals = {
|
|||
}
|
||||
}
|
||||
|
||||
const SIBLING_DOMAIN_FILENAME_ALLOWLIST = new Set([
|
||||
'packages/core/src/canvas/ai-overlays.ts',
|
||||
'packages/core/src/canvas/selection-labels.ts'
|
||||
])
|
||||
|
||||
const noTopLevelPrefixedTestFiles = createProgramFilenameRule({
|
||||
description: 'Disallow top-level test files that encode domains as filename prefixes',
|
||||
check(file) {
|
||||
|
|
@ -1519,8 +1509,6 @@ const noSiblingDomainPrefixedFiles = createProgramFilenameRule({
|
|||
const parts = name.split('-')
|
||||
if (parts.length < 2) return false
|
||||
|
||||
if (SIBLING_DOMAIN_FILENAME_ALLOWLIST.has(relativeFromRepo(file))) return false
|
||||
|
||||
const prefix = parts[0]
|
||||
const suffix = parts.at(-1)
|
||||
const domain = existsSync(`${dir}${prefix}`)
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ import {
|
|||
import { rotatedCorners } from '#core/geometry'
|
||||
import type { SceneNode, SceneGraph } from '#core/scene-graph'
|
||||
|
||||
import type { SkiaRenderer, RenderOverlays } from './renderer'
|
||||
import type { SkiaRenderer, RenderOverlays } from '#core/canvas/renderer'
|
||||
|
||||
function getOverlayRotation(node: SceneNode, overlays?: RenderOverlays): number {
|
||||
return overlays?.rotationPreview?.nodeId === node.id
|
||||
|
|
@ -8,8 +8,8 @@ import {
|
|||
} from '#core/constants'
|
||||
import type { SceneGraph } from '#core/scene-graph'
|
||||
|
||||
import { drawNodeHighlightRect } from './highlight-rect'
|
||||
import type { SkiaRenderer } from './renderer'
|
||||
import { drawNodeHighlightRect } from '#core/canvas/highlight-rect'
|
||||
import type { SkiaRenderer } from '#core/canvas/renderer'
|
||||
|
||||
export function drawAiOverlays(r: SkiaRenderer, canvas: Canvas, graph: SceneGraph): void {
|
||||
const now = performance.now()
|
||||
|
|
@ -12,6 +12,6 @@ export {
|
|||
export { drawAutoLayoutHover } from './auto-layout-hover'
|
||||
export { drawFlashes, drawLayoutInsertIndicator, drawMarquee, drawSnapGuides } from './feedback'
|
||||
export { drawTextEditOverlay } from './text-edit'
|
||||
export { drawSelectionLabels } from '#core/canvas/selection-labels'
|
||||
export { drawSelectionLabels } from '#core/canvas/labels/selection'
|
||||
export { drawPenOverlay, drawRemoteCursors } from '#core/canvas/pen-overlay'
|
||||
export { drawNodeEditOverlay } from '#core/canvas/node-edit-overlay'
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import type { ImageFilter, MaskFilter, Canvas, Paint, Path } from 'canvaskit-wasm'
|
||||
|
||||
import * as AiOverlays from '#core/canvas/ai-overlays'
|
||||
import * as AiOverlays from '#core/canvas/overlays/ai'
|
||||
import * as Effects from '#core/canvas/effects'
|
||||
import * as Fills from '#core/canvas/fills'
|
||||
import * as Labels from '#core/canvas/labels/draw'
|
||||
|
|
|
|||
Loading…
Reference in a new issue