index.ts 833 B

12345678910111213141516171819202122232425262728293031
  1. import { ModuleControl } from "queenjs";
  2. import { EditorModule } from "../../module";
  3. import { RxValue } from "../ReactCtrl/rxValue";
  4. import { history } from "../../objects/DesignTemp/factory";
  5. export class PropsCtrl extends ModuleControl<EditorModule> {
  6. state = RxValue.create({
  7. propId: "",
  8. isMultiSel: false,
  9. }, history);
  10. getCurrComp() {
  11. return this.controls.pageCtrl.compMap[this.state.propId];
  12. }
  13. initEvents() {
  14. const gizmo = this.controls.selectCtrl.gizmo;
  15. gizmo.state.onTransformChanged((t)=>{
  16. this.state.isMultiSel = t.selected.length > 1;
  17. })
  18. gizmo.state.onLastIdChanged((id)=>{
  19. this.state.propId = id;
  20. })
  21. }
  22. showProp(id:string) {
  23. this.state.setPropId(id);
  24. this.state.setIsMultiSel(false);
  25. }
  26. }