fix: drag block issue (#9902)

### Changed
- Added support for changing the preview offset during dragging.
- Fixed the preview rendering for embed block and surface-ref block
- Resolved an issue where the host element might be reused in certain cases, which could cause unexpected behavior
- Moved viewport-related constants and methods to a more appropriate location
This commit is contained in:
doouding
2025-02-05 07:25:53 +00:00
parent abeff8bb1a
commit 02122098c7
22 changed files with 177 additions and 138 deletions
@@ -60,9 +60,12 @@ export class ViewManager extends GfxExtension {
this._disposable.add(
surface.elementAdded.on(payload => {
const model = surface.getElementById(payload.id)!;
const View = this._viewCtorMap.get(model.type) ?? GfxElementModelView;
const ViewCtor =
this._viewCtorMap.get(model.type) ?? GfxElementModelView;
const view = new ViewCtor(model, this.gfx);
this._viewMap.set(model.id, new View(model, this.gfx));
this._viewMap.set(model.id, view);
view.onCreated();
})
);
@@ -72,7 +72,6 @@ export class GfxElementModelView<
readonly gfx: GfxController
) {
this.model = model;
this.onCreated();
}
static setup(di: Container): void {