feat: dnd image preview && edgeless dnd preview issue (#10177)

### Changed
- Add new image block to render dnd preview
- Fixed the bug that dragging uploaded image does not have width and height
- Fixed the bug that drag image block from page to edgeless does not have width and height
- Better edgeless dnd preview
This commit is contained in:
doouding
2025-02-14 16:02:03 +00:00
parent 631c8b8145
commit 8ece812017
11 changed files with 245 additions and 53 deletions

View File

@@ -46,7 +46,7 @@ export class GfxViewportElement extends WithDisposable(ShadowlessElement) {
}
`;
private readonly _hideOutsideBlock = requestThrottledConnectedFrame(() => {
private readonly _hideOutsideBlock = () => {
if (this.getModelsInViewport && this.host) {
const host = this.host;
const modelsInViewport = this.getModelsInViewport();
@@ -73,7 +73,7 @@ export class GfxViewportElement extends WithDisposable(ShadowlessElement) {
this._lastVisibleModels = modelsInViewport;
}
}, this);
};
private _lastVisibleModels?: Set<GfxBlockElementModel>;
@@ -95,14 +95,13 @@ export class GfxViewportElement extends WithDisposable(ShadowlessElement) {
const viewportUpdateCallback = () => {
this._refreshViewport();
this._hideOutsideBlock();
};
if (!this.enableChildrenSchedule) {
delete this.scheduleUpdateChildren;
}
viewportUpdateCallback();
this._hideOutsideBlock();
this.disposables.add(
this.viewport.viewportUpdated.on(() => viewportUpdateCallback())
);