mirror of
https://github.com/Tencent/tmagic-editor.git
synced 2025-06-28 05:09:23 +08:00
feat(editor): 选中组件,组件自动滚动到视窗内
This commit is contained in:
parent
91e2591495
commit
50937c2867
@ -155,6 +155,8 @@ export default class StageCore extends EventEmitter {
|
|||||||
|
|
||||||
this.mask.setLayout(el);
|
this.mask.setLayout(el);
|
||||||
this.dr.select(el, event);
|
this.dr.select(el, event);
|
||||||
|
this.mask.scrollIntoView(el);
|
||||||
|
|
||||||
this.selectedDom = el;
|
this.selectedDom = el;
|
||||||
|
|
||||||
if (this.renderer.contentWindow) {
|
if (this.renderer.contentWindow) {
|
||||||
|
@ -173,6 +173,16 @@ export default class StageMask extends Rule {
|
|||||||
this.setMode(isFixedParent(el) ? Mode.FIXED : Mode.ABSOLUTE);
|
this.setMode(isFixedParent(el) ? Mode.FIXED : Mode.ABSOLUTE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public scrollIntoView(el: HTMLElement): void {
|
||||||
|
if (this.mode === Mode.FIXED) return;
|
||||||
|
|
||||||
|
el.scrollIntoView();
|
||||||
|
if (!this.pageScrollParent) return;
|
||||||
|
this.scrollLeft = this.pageScrollParent.scrollLeft;
|
||||||
|
this.scrollTop = this.pageScrollParent.scrollTop;
|
||||||
|
this.scroll();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 销毁实例
|
* 销毁实例
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user