layout.ts 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. import { TipIcons } from "../../components/TipIcons";
  2. import { createToolbars } from "./default";
  3. export const LayoutToolbars = createToolbars({
  4. xLeft: {
  5. component: TipIcons.AlignXLeft,
  6. getVisible(comp) { return this.store.selected.length > 0 },
  7. onClick(comp) {
  8. this.actions.setAlignX(0);
  9. },
  10. },
  11. xCenter: {
  12. component: TipIcons.AlignXCenter,
  13. getVisible(comp) { return this.store.selected.length > 0 },
  14. onClick(comp) {
  15. this.actions.setAlignX(1);
  16. },
  17. },
  18. xRight: {
  19. component: TipIcons.AlignXRight,
  20. getVisible(comp) { return this.store.selected.length > 0 },
  21. onClick(comp) {
  22. this.actions.setAlignX(2);
  23. },
  24. },
  25. xBetween: {
  26. component: TipIcons.AlignXBetween,
  27. getVisible(comp) { return this.store.selected.length > 2 },
  28. onClick(comp) {
  29. this.actions.setAlignX(3);
  30. },
  31. },
  32. yBetween: {
  33. component: TipIcons.AlignYBetween,
  34. getVisible(comp) { return this.store.selected.length > 2 },
  35. onClick(comp) {
  36. this.actions.setAlignY(3);
  37. },
  38. },
  39. YTop: {
  40. component: TipIcons.AlignYTop,
  41. getVisible(comp) { return this.store.selected.length > 0 },
  42. onClick(comp) {
  43. this.actions.setAlignY(0);
  44. },
  45. },
  46. YCenter: {
  47. component: TipIcons.AlignYCenter,
  48. getVisible(comp) { return this.store.selected.length > 0 },
  49. onClick(comp) {
  50. this.actions.setAlignY(1);
  51. },
  52. },
  53. YBottom: {
  54. component: TipIcons.AlignYBottom,
  55. getVisible(comp) { return this.store.selected.length > 0 },
  56. onClick(comp) {
  57. this.actions.setAlignY(2);
  58. },
  59. },
  60. Copy: {
  61. component: TipIcons.Copy,
  62. getVisible(comp) { return !!this.store.lastSelected },
  63. onClick(comp) {
  64. this.actions.copyLastSelected();
  65. },
  66. },
  67. SameWidth: {
  68. component: TipIcons.SameWidth,
  69. getVisible(comp) { return this.store.selected.length > 1 && !!this.store.lastSelected },
  70. onClick(comp) {
  71. this.actions.setSameSize(true);
  72. },
  73. },
  74. SameHeight: {
  75. component: TipIcons.SameHeight,
  76. getVisible(comp) { return this.store.selected.length > 1 && !!this.store.lastSelected },
  77. onClick(comp) {
  78. this.actions.setSameSize(false);
  79. },
  80. },
  81. });