chore(editor): hide tweakpane for turbo renderer (#10846)
This commit is contained in:
@@ -18,8 +18,7 @@
|
|||||||
"@blocksuite/store": "workspace:*",
|
"@blocksuite/store": "workspace:*",
|
||||||
"@types/lodash-es": "^4.17.12",
|
"@types/lodash-es": "^4.17.12",
|
||||||
"lodash-es": "^4.17.21",
|
"lodash-es": "^4.17.21",
|
||||||
"rxjs": "^7.8.1",
|
"rxjs": "^7.8.1"
|
||||||
"tweakpane": "^4.0.5"
|
|
||||||
},
|
},
|
||||||
"exports": {
|
"exports": {
|
||||||
".": "./src/index.ts",
|
".": "./src/index.ts",
|
||||||
|
|||||||
@@ -4,10 +4,8 @@ import {
|
|||||||
GfxControllerIdentifier,
|
GfxControllerIdentifier,
|
||||||
type Viewport,
|
type Viewport,
|
||||||
} from '@blocksuite/block-std/gfx';
|
} from '@blocksuite/block-std/gfx';
|
||||||
import { Pane } from 'tweakpane';
|
|
||||||
|
|
||||||
import { BlockLayoutHandlersIdentifier } from './layout/block-layout-provider';
|
import { BlockLayoutHandlersIdentifier } from './layout/block-layout-provider';
|
||||||
import type { ViewportTurboRendererExtension } from './turbo-renderer';
|
|
||||||
import type { BlockLayout, RenderingState, ViewportLayout } from './types';
|
import type { BlockLayout, RenderingState, ViewportLayout } from './types';
|
||||||
|
|
||||||
export function syncCanvasSize(canvas: HTMLCanvasElement, host: HTMLElement) {
|
export function syncCanvasSize(canvas: HTMLCanvasElement, host: HTMLElement) {
|
||||||
@@ -89,22 +87,6 @@ export function getViewportLayout(
|
|||||||
return layout;
|
return layout;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function initTweakpane(
|
|
||||||
renderer: ViewportTurboRendererExtension,
|
|
||||||
viewportElement: HTMLElement
|
|
||||||
) {
|
|
||||||
const debugPane = new Pane({ container: viewportElement });
|
|
||||||
const paneElement = debugPane.element;
|
|
||||||
paneElement.style.position = 'absolute';
|
|
||||||
paneElement.style.top = '10px';
|
|
||||||
paneElement.style.right = '10px';
|
|
||||||
paneElement.style.width = '250px';
|
|
||||||
debugPane.title = 'Viewport Turbo Renderer';
|
|
||||||
debugPane.addButton({ title: 'Invalidate' }).on('click', () => {
|
|
||||||
renderer.invalidate();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
export function debugLog(message: string, state: RenderingState) {
|
export function debugLog(message: string, state: RenderingState) {
|
||||||
console.log(
|
console.log(
|
||||||
`%c[ViewportTurboRenderer]%c ${message} | state=${state}`,
|
`%c[ViewportTurboRenderer]%c ${message} | state=${state}`,
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ import debounce from 'lodash-es/debounce';
|
|||||||
import {
|
import {
|
||||||
debugLog,
|
debugLog,
|
||||||
getViewportLayout,
|
getViewportLayout,
|
||||||
initTweakpane,
|
|
||||||
paintPlaceholder,
|
paintPlaceholder,
|
||||||
syncCanvasSize,
|
syncCanvasSize,
|
||||||
} from './renderer-utils';
|
} from './renderer-utils';
|
||||||
@@ -83,7 +82,6 @@ export class ViewportTurboRendererExtension extends GfxExtension {
|
|||||||
const mountPoint = document.querySelector('.affine-edgeless-viewport');
|
const mountPoint = document.querySelector('.affine-edgeless-viewport');
|
||||||
if (mountPoint) {
|
if (mountPoint) {
|
||||||
mountPoint.append(this.canvas);
|
mountPoint.append(this.canvas);
|
||||||
initTweakpane(this, mountPoint as HTMLElement);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const subscription = this.viewport.elementReady.subscribe(element => {
|
const subscription = this.viewport.elementReady.subscribe(element => {
|
||||||
|
|||||||
@@ -2907,7 +2907,6 @@ __metadata:
|
|||||||
"@types/lodash-es": "npm:^4.17.12"
|
"@types/lodash-es": "npm:^4.17.12"
|
||||||
lodash-es: "npm:^4.17.21"
|
lodash-es: "npm:^4.17.21"
|
||||||
rxjs: "npm:^7.8.1"
|
rxjs: "npm:^7.8.1"
|
||||||
tweakpane: "npm:^4.0.5"
|
|
||||||
languageName: unknown
|
languageName: unknown
|
||||||
linkType: soft
|
linkType: soft
|
||||||
|
|
||||||
@@ -32216,7 +32215,7 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"tweakpane@npm:^4.0.4, tweakpane@npm:^4.0.5":
|
"tweakpane@npm:^4.0.4":
|
||||||
version: 4.0.5
|
version: 4.0.5
|
||||||
resolution: "tweakpane@npm:4.0.5"
|
resolution: "tweakpane@npm:4.0.5"
|
||||||
checksum: 10/7719a15ce96dd2b936b277239ccb18ee6a75ed2416a6bdacfc537515d909da6edd50161b12e91441ace5243efad3a14a98fe6e5475cae2617d7647a197117e64
|
checksum: 10/7719a15ce96dd2b936b277239ccb18ee6a75ed2416a6bdacfc537515d909da6edd50161b12e91441ace5243efad3a14a98fe6e5475cae2617d7647a197117e64
|
||||||
|
|||||||
Reference in New Issue
Block a user