@lancom/shared 0.0.342 → 0.0.344
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.
- package/components/editor/editor_workspace/editor-workspace.scss +4 -4
- package/components/editor/editor_workspace/editor-workspace.vue +16 -15
- package/components/editor/editor_workspace/editor_workspace_side/editor-workspace-side.vue +1 -1
- package/components/editor/mobile_editor_product_details/mobile-editor-product-details.scss +3 -2
- package/components/editor/mobile_editor_product_details/mobile-editor-product-details.vue +13 -6
- package/package.json +1 -1
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
background-color: white;
|
|
11
11
|
display: flex;
|
|
12
12
|
justify-content: center;
|
|
13
|
-
z-index:
|
|
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:
|
|
24
|
-
height:
|
|
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:
|
|
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':
|
|
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':
|
|
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':
|
|
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
|
|
167
|
+
return this.printAreaZoomSize?.width;
|
|
168
168
|
},
|
|
169
169
|
isZoomIn() {
|
|
170
|
-
|
|
170
|
+
console.log('selectedLayer: ', this.selectedLayer);
|
|
171
|
+
return this.zoomPrintArea && !!this.selectedLayer;
|
|
171
172
|
},
|
|
172
173
|
printAreaZoomInStyles() {
|
|
173
|
-
if (this.fabricHelper && this.
|
|
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.
|
|
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
|
|
|
@@ -215,8 +215,12 @@ export default {
|
|
|
215
215
|
...mapMutations([
|
|
216
216
|
'setEditableSide',
|
|
217
217
|
'setSelectedPrintArea',
|
|
218
|
-
'setEditablePrintArea'
|
|
218
|
+
'setEditablePrintArea',
|
|
219
|
+
'setSelectedLayer'
|
|
219
220
|
]),
|
|
221
|
+
zoomOut() {
|
|
222
|
+
this.setSelectedLayer(null);
|
|
223
|
+
},
|
|
220
224
|
onWorkspaceChange({ size, fabricHelper }) {
|
|
221
225
|
this.fabricHelper = fabricHelper;
|
|
222
226
|
this.size = size;
|
|
@@ -271,11 +275,8 @@ export default {
|
|
|
271
275
|
this.$refs.editor.toogleBoundBox(state, printAreaOption);
|
|
272
276
|
}
|
|
273
277
|
},
|
|
274
|
-
zoomIn() {
|
|
275
|
-
this.zoomSize = 720;
|
|
276
|
-
},
|
|
277
278
|
zoomOut() {
|
|
278
|
-
|
|
279
|
+
|
|
279
280
|
}
|
|
280
281
|
}
|
|
281
282
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="MobileEditorProductDetails__wrapper">
|
|
3
3
|
<div
|
|
4
|
-
v-if="
|
|
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-
|
|
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.
|
|
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
|
-
|
|
154
|
+
const safeAreaInsetBottom = window.innerHeight - 78;
|
|
155
|
+
this.top = `${safeAreaInsetBottom}px`;
|
|
149
156
|
this.width = `${window.outerWidth}px`;
|
|
150
157
|
},
|
|
151
158
|
focusOnDefaultProduct() {
|