123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- import { set } from "lodash";
- import { EditorModule } from "..";
- import { DesignComp } from "../../objects/DesignTemp/DesignComp";
- import { CompObject } from "../../controllers/SelectCtrl/compObj";
- export const manualActions = EditorModule.action({
- pickComp(compId: string) {
- const selectCardChild = (id:string)=>{
- const paths = this.helper.getCompTrees(id)
- const cardChilds = paths[2];
- if (cardChilds) {
- this.controls.selectCtrl.selecteObjs([new CompObject(cardChilds)]);
- } else {
- this.controls.selectCtrl.selecteObjs([])
- }
- }
- if (this.store.currCompId == compId) {
- if (this.controls.selectCtrl.selected.length < 1 ) {
- selectCardChild(compId);
- }else {
- this.controls.selectCtrl.upgateGizmoStyle();
- }
- return;
- }
- //const { historyCtrl } = this.controls;
- const history = this.controls.historyCtrl.history;
- let preCompId = this.store.currCompId;
- let lasCompId = compId;
- history.record({undo:()=>{
-
- this.store.setCurrComp(preCompId);
- selectCardChild(preCompId);
- }, redo:()=>{
- this.store.setCurrComp(lasCompId);
- selectCardChild(lasCompId);
- }} as any)
- history.submit();
- this.store.setCurrComp(compId);
- selectCardChild(compId);
- },
- updateCompData(comp: DesignComp, path: string, value: any) {
- const { historyCtrl } = this.controls;
- historyCtrl.historyActionDoing = true;
- historyCtrl.historyCombine = true;
- set(comp, path, value);
- historyCtrl.historyCombine = false;
- historyCtrl.historyActionDoing = false;
- },
- submitUpdate() {
- this.controls.historyCtrl.history.submit();
- },
- });
|