Skip to content

Commit

Permalink
feat:autoFocus
Browse files Browse the repository at this point in the history
  • Loading branch information
ananzhusen committed Oct 24, 2024
1 parent c313799 commit 57ff2ff
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
14 changes: 14 additions & 0 deletions packages/core/src/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -981,6 +981,12 @@ export class Meta2d {
this.startVideo();
this.doInitJS();
this.doInitFn();
setTimeout(()=>{
const pen = this.store.data.pens.find((pen)=>pen.autofocus);
if(pen){
this.focus(pen.id);
}
},100);
if (this.store.data.iconUrls) {
for (const item of this.store.data.iconUrls) {
loadCss(item, () => {
Expand Down Expand Up @@ -1835,6 +1841,14 @@ export class Meta2d {
this.render();
}

focus(id:string){
const pen = this.findOne(id);
if(pen){
this.store.hover = pen;
this.store.hover.calculative.hover = true;
this.showInput(pen);
}
}
/**
* 删除画笔
* @param pens 需要删除的画笔们
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/pen/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,7 @@ export interface Pen extends Rect {
animateShadowColor?: string;
animateShadowBlur?: number;
input?: boolean;
autofocus?: boolean;
dropdownList?: Dropdown[];
dropdownBackground?: string;
dropdownColor?: string;
Expand Down

0 comments on commit 57ff2ff

Please sign in to comment.