@lancom/shared 0.0.342 → 0.0.343

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -10,7 +10,7 @@
10
10
  background-color: white;
11
11
  display: flex;
12
12
  justify-content: center;
13
- z-index: 1;
13
+ z-index: 1004;
14
14
  }
15
15
  &__sides {
16
16
  position: relative;
@@ -20,8 +20,8 @@
20
20
  &-container {
21
21
  position: relative;
22
22
  margin: 0 auto;
23
- width: 290px;
24
- height: 290px;
23
+ width: 350px;
24
+ height: 350px;
25
25
  max-width: 100%;
26
26
  @media (min-width: $bp-extra-small-min) {
27
27
  width: 400px;
@@ -101,7 +101,7 @@
101
101
  position: sticky;
102
102
  bottom: 0px;
103
103
  background: white;
104
- width: 290px;
104
+ width: 350px;
105
105
  @media (min-width: $bp-extra-small-min) {
106
106
  width: 370px;
107
107
  }
@@ -48,7 +48,7 @@
48
48
  <div
49
49
  class="EditorWorkspace__sides-container"
50
50
  :class="{
51
- 'EditorWorkspace__sides-container--zoom-in': zoomPrintArea || isZoomIn
51
+ 'EditorWorkspace__sides-container--zoom-in': isZoomIn
52
52
  }"
53
53
  :style="printAreaZoomInStyles">
54
54
  <div
@@ -69,7 +69,6 @@
69
69
  :class="editableSide.id"
70
70
  :zoom-size="sideZoomSize"
71
71
  class="EditorWorkspace__side rotate-y-element"
72
- @zoom-in="zoomIn()"
73
72
  @workspace="onWorkspaceChange($event)">
74
73
  </editor-workspace-side>
75
74
  </transition>
@@ -77,7 +76,7 @@
77
76
  <div
78
77
  class="EditorWorkspace__sides-toggle"
79
78
  :class="{
80
- 'EditorWorkspace__sides-toggle--fixed': zoomPrintArea || isZoomIn
79
+ 'EditorWorkspace__sides-toggle--fixed': isZoomIn
81
80
  }"
82
81
  @click="toggleSide()">
83
82
  <i class="icon-rotate-tee"></i>
@@ -92,9 +91,10 @@
92
91
  </client-only>
93
92
  </breakpoint>
94
93
  <div
94
+ v-if="!isZoomIn"
95
95
  class="EditorWorkspace__print-area-options"
96
96
  :class="{
97
- 'EditorWorkspace__print-area-options--bottom': zoomPrintArea || isZoomIn
97
+ 'EditorWorkspace__print-area-options--bottom': isZoomIn
98
98
  }">
99
99
  <editor-print-area-options
100
100
  v-if="productDetailsLoaded"
@@ -136,7 +136,6 @@ export default {
136
136
  fabricHelper: null,
137
137
  preloading: true,
138
138
  isRotating: false,
139
- zoomSize: null,
140
139
  productSides: [
141
140
  { label: 'Front', value: 'front' },
142
141
  { label: 'Back', value: 'back' }
@@ -155,6 +154,7 @@ export default {
155
154
  computed: {
156
155
  ...mapGetters([
157
156
  'product',
157
+ 'selectedLayer',
158
158
  'productDetailsLoaded',
159
159
  'selectedPrintArea',
160
160
  'editablePrintArea',
@@ -164,13 +164,14 @@ export default {
164
164
  'editorSize'
165
165
  ]),
166
166
  sideZoomSize() {
167
- return this.printAreaZoomSize?.width || this.zoomSize;
167
+ return this.printAreaZoomSize?.width;
168
168
  },
169
169
  isZoomIn() {
170
- return !!this.zoomSize;
170
+ console.log('selectedLayer: ', this.selectedLayer);
171
+ return this.zoomPrintArea && !!this.selectedLayer;
171
172
  },
172
173
  printAreaZoomInStyles() {
173
- if (this.fabricHelper && this.zoomPrintArea) {
174
+ if (this.fabricHelper && this.isZoomIn) {
174
175
  return {
175
176
  width: `${this.printAreaZoomSize.width}px`,
176
177
  height: `${this.printAreaZoomSize.height}px`,
@@ -182,14 +183,13 @@ export default {
182
183
  return {};
183
184
  },
184
185
  printAreaZoomSize() {
185
- if (this.fabricHelper && this.zoomPrintArea) {
186
+ if (this.fabricHelper && this.isZoomIn) {
186
187
  const { printAreaRect } = this.fabricHelper;
187
188
  const printAreaWidth = printAreaRect.width;
188
189
  const printAreaHeight = printAreaRect.height;
189
190
 
190
191
 
191
192
  const targetWidth = this.editorSize.width * 0.6;
192
- const targetHeight = this.editorSize.height * 0.6;
193
193
  const scaleX = targetWidth / printAreaWidth;
194
194
  const scale = scaleX;
195
195
 
@@ -271,12 +271,6 @@ export default {
271
271
  this.$refs.editor.toogleBoundBox(state, printAreaOption);
272
272
  }
273
273
  },
274
- zoomIn() {
275
- this.zoomSize = 720;
276
- },
277
- zoomOut() {
278
- this.zoomSize = null;
279
- }
280
274
  }
281
275
  };
282
276
  </script>
@@ -297,7 +297,7 @@ export default {
297
297
  },
298
298
  calcWorkspaceSize(skipZoom) {
299
299
  const sizes = {
300
- mini: 290,
300
+ mini: 350,
301
301
  xs: 400,
302
302
  sm: 580,
303
303
  md: 430,
@@ -11,9 +11,10 @@
11
11
  }
12
12
  &__menu {
13
13
  position: fixed;
14
- // right: 0;
15
- // top: calc(100vh - 78px);
16
14
  left: 0;
15
+ right: 0;
16
+ -webkit-transform: translateZ(0);
17
+ transform: translateZ(0);
17
18
  height: 78px;
18
19
  z-index: 999999;
19
20
  display: grid;
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <div class="MobileEditorProductDetails__wrapper">
3
3
  <div
4
- v-if="width"
4
+ v-if="top"
5
5
  class="MobileEditorProductDetails__menu"
6
6
  :style="{ width, top }">
7
7
  <editor-pricing
@@ -62,7 +62,7 @@
62
62
  @click="hide">
63
63
  </div>
64
64
  <div
65
- v-show="isOpen"
65
+ v-if="isOpen"
66
66
  key="container"
67
67
  class="MobileEditorProductDetails__container"
68
68
  @close="hide">
@@ -91,6 +91,7 @@
91
91
 
92
92
  <script>
93
93
  import { createNamespacedHelpers } from 'vuex';
94
+ import throttle from 'lodash.throttle';
94
95
  import { EventBus } from '@lancom/shared/assets/js/utils/event-bus';
95
96
  import addToCartMixin from '@lancom/shared/mixins/add-to-cart';
96
97
  import EditorWorkspace from '../editor_workspace/editor-workspace';
@@ -112,7 +113,8 @@ export default {
112
113
  isOpen: false,
113
114
  currentTab: null,
114
115
  top: null,
115
- width: null
116
+ width: null,
117
+ updateMobileMenuPositionWithThrottle: throttle(this.updateMobileMenuPosition, 50, { trailing: false }),
116
118
  };
117
119
  },
118
120
  computed: {
@@ -120,12 +122,16 @@ export default {
120
122
  },
121
123
  mounted() {
122
124
  EventBus.$on('focus-on-default-product', this.focusOnDefaultProduct);
125
+ window.addEventListener('resize', this.updateMobileMenuPositionWithThrottle);
126
+ window.addEventListener('scroll', this.updateMobileMenuPositionWithThrottle);
127
+ window.addEventListener('orientationchange', this.updateMobileMenuPositionWithThrottle);
123
128
  this.updateMobileMenuPosition();
124
- window.addEventListener('resize', this.updateMobileMenuPosition);
125
129
  },
126
130
  beforeDestroy() {
127
131
  EventBus.$off('focus-on-default-product', this.focusOnDefaultProduct);
128
- window.removeEventListener('resize', this.updateMobileMenuPosition);
132
+ window.removeEventListener('resize', this.updateMobileMenuPositionWithThrottle);
133
+ window.addEventListener('scroll', this.updateMobileMenuPositionWithThrottle);
134
+ window.addEventListener('orientationchange', this.updateMobileMenuPositionWithThrottle);
129
135
  },
130
136
  methods: {
131
137
  ...mapMutations(['setEditModeSelectedLayer', 'removeTemplateLayer', 'setSelectedLayer']),
@@ -145,7 +151,8 @@ export default {
145
151
  }, 250);
146
152
  },
147
153
  updateMobileMenuPosition() {
148
- this.top = `${window.outerHeight - 78}px`;
154
+ const safeAreaInsetBottom = window.innerHeight - 78;
155
+ this.top = `${safeAreaInsetBottom}px`;
149
156
  this.width = `${window.outerWidth}px`;
150
157
  },
151
158
  focusOnDefaultProduct() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lancom/shared",
3
- "version": "0.0.342",
3
+ "version": "0.0.343",
4
4
  "description": "lancom common scripts",
5
5
  "author": "e.tokovenko <e.tokovenko@gmail.com>",
6
6
  "repository": {