diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml deleted file mode 100644 index 430c25c..0000000 --- a/.github/workflows/test.yml +++ /dev/null @@ -1,27 +0,0 @@ -name: Test - -on: - push: - branches: [ main ] - pull_request: - -jobs: - test: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - - - name: Setup Node.js - uses: actions/setup-node@v3 - with: - cache: 'yarn' - - - uses: actions/cache@v3 - with: - path: node_modules - key: ${{ runner.OS }}-build-${{ hashFiles('**/package-lock.json') }} - - - run: yarn install - - - run: yarn test diff --git a/src/pages/panel/devtools/konvaDevtools.ts b/src/pages/panel/devtools/konvaDevtools.ts index 23ba24d..cb36852 100644 --- a/src/pages/panel/devtools/konvaDevtools.ts +++ b/src/pages/panel/devtools/konvaDevtools.ts @@ -1,5 +1,4 @@ import type TKonva from "konva"; -import { OutlineNode } from "../types"; export default function konvaDevtools() { const win = window as any; @@ -22,19 +21,6 @@ export default function konvaDevtools() { return undefined; } - function getRenderedBy(node: TKonva.Node) { - const trees: string[] = []; - - const parent = node.getParent(); - if (parent) { - trees.push(node.getParent().getClassName()); - const result = getRenderedBy(parent); - trees.push(result); - } - - return trees; - } - function Konva(): typeof TKonva { return getGlobal("Konva"); } @@ -44,8 +30,8 @@ export default function konvaDevtools() { content(stageIndex = 0) { return Konva().stages[stageIndex].getContent(); }, - renderedBy(node: TKonva.Node) { - return getRenderedBy(node); + stage(stageIndex = 0) { + return Konva().stages[stageIndex]; }, }; } diff --git a/src/pages/panel/devtools/konvaDevtoolsOverlay.ts b/src/pages/panel/devtools/konvaDevtoolsOverlay.ts index 11f251c..4c232fe 100644 --- a/src/pages/panel/devtools/konvaDevtoolsOverlay.ts +++ b/src/pages/panel/devtools/konvaDevtoolsOverlay.ts @@ -33,7 +33,10 @@ export default function konvaDevtoolsOverlay(devtools: KonvaDevtools) { function calibrateOverlay() { const content = devtools.content(stageIndex); const contentBounds = content.getBoundingClientRect(); - overlayEl.style.transform = `translate(${contentBounds.x}px, ${contentBounds.y}px)`; + const stage = devtools.stage(stageIndex); + overlayEl.style.transform = `translate(${ + contentBounds.x + stage.x() + }px, ${contentBounds.y + stage.y()}px)`; } let throttle = 0;