image.tsx 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. import { isWeixinBrowser } from "@/controllers/wxController";
  2. import { EditorModule } from "..";
  3. import PreviewImagesModal from "../../components/PreviewImagesModal";
  4. export const ImgCompActions = EditorModule.action({
  5. handleImageHotKey(key: string) {
  6. if (!this.store.isEditMode) return;
  7. if (this.store.currComp?.compKey !== "Image") return;
  8. const value = this.store.currComp.value;
  9. return;
  10. // if (key == "w") {
  11. // value.y = (parseFloat(value.y) - 0.5).toFixed(2);
  12. // return;
  13. // }
  14. // if (key == "s") {
  15. // value.y = (parseFloat(value.y) + 0.5).toFixed(2);
  16. // return;
  17. // }
  18. // if (key == "a") {
  19. // value.x = (parseFloat(value.x) - 0.5).toFixed(2);
  20. // return;
  21. // }
  22. // if (key == "d") {
  23. // value.x = (parseFloat(value.x) + 0.5).toFixed(2);
  24. // return;
  25. // }
  26. // if (key == "q") {
  27. // value.s = (parseFloat(value.s) - 0.05).toFixed(2);
  28. // return;
  29. // }
  30. // if (key == "e") {
  31. // value.s = (parseFloat(value.s) + 0.05).toFixed(2);
  32. // return;
  33. // }
  34. },
  35. previewImage(url, previewImageList) {
  36. if (this.controls.screenCtrl.state.screen.useFor == "pc") return;
  37. if (isWeixinBrowser()) {
  38. this.controls.wxCtrl.setPreviewData(url, previewImageList);
  39. } else {
  40. this.showModal(
  41. <PreviewImagesModal data={previewImageList} current={url} />,
  42. {
  43. fullscreen: true,
  44. }
  45. );
  46. }
  47. },
  48. });