diff --git a/src/App.vue b/src/App.vue index f34af7e..7510326 100644 --- a/src/App.vue +++ b/src/App.vue @@ -2,6 +2,7 @@ .app page-intro image-search( + :isTouch="isTouch" :items="items" ) page-footer @@ -14,6 +15,11 @@ import PageFooter from './components/PageFooter.vue' export default { name: 'App', + + data(){ + const isTouch = window.matchMedia("(pointer: coarse)").matches; + return {isTouch}; + }, props: { items: Array, diff --git a/src/components/ImageSearch.vue b/src/components/ImageSearch.vue index 82db9c1..aa8798a 100644 --- a/src/components/ImageSearch.vue +++ b/src/components/ImageSearch.vue @@ -35,68 +35,33 @@ main.image-search vue-photo-zoom-pro( :disabled="false" - :high-url="imageFile" type="circle" + :outZoomer="isTouch" :scale="1.5" ref="photoZoom" :activeItem="activeItem" :isSelected="isSelected" @found="found" ) - svg( - viewBox="0 0 1567 2475" - xmlns="http://www.w3.org/2000/svg" - ref="svg" - ) - symbol( - id="check" - viewBox="0 0 24 24" - ) - path( - d="M0 0h24v24H0V0z" fill="none" - ) - path( - d="M12 4c-4.41 0-8 3.59-8 8s3.59 8 8 8 8-3.59 8-8-3.59-8-8-8zm-2 13l-4-4 1.41-1.41L10 14.17l6.59-6.59L18 9l-8 8z" - ) - path( - d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8zm4.59-12.42L10 14.17l-2.59-2.58L6 13l4 4 8-8z" fill="#ffffff" - ) - - image( - :href="imageFile" - width="1567" - height="2475" - ) - - template( - v-for="item in items" - ) - polygon( - ref="polygons" - v-bind="polygonAttrs(item)" - @mouseenter="highlight(item);" - @mouseleave="unhighlight(item)" - ) - use.checkmark( - v-if="item.found" - v-bind="checkboxAttrs(item)" - href="#check" - fill="#629f37" - width="40" - height="40" - transform="translate(-20 -50)" - ) + image-svg.preview( + :items="items" + :imageFile="imageFile" + @enter="enter" + @leave="leave" + ) + + \ No newline at end of file diff --git a/src/components/VuePhotoZoomPro/Selector.vue b/src/components/VuePhotoZoomPro/Selector.vue deleted file mode 100644 index 8769d0f..0000000 --- a/src/components/VuePhotoZoomPro/Selector.vue +++ /dev/null @@ -1,136 +0,0 @@ - - - - - - diff --git a/src/components/VuePhotoZoomPro/VuePhotoZoomPro.vue b/src/components/VuePhotoZoomPro/VuePhotoZoomPro.vue index f47890d..74d5f6e 100644 --- a/src/components/VuePhotoZoomPro/VuePhotoZoomPro.vue +++ b/src/components/VuePhotoZoomPro/VuePhotoZoomPro.vue @@ -3,9 +3,9 @@
- + + @@ -34,194 +40,204 @@ v-bind="zoomerProps" :style="outZoomerPosition" > - + + +
+ \ No newline at end of file diff --git a/src/components/VuePhotoZoomPro/PhotoMask.vue b/src/components/VuePhotoZoomPro/components/photo-mask.vue similarity index 99% rename from src/components/VuePhotoZoomPro/PhotoMask.vue rename to src/components/VuePhotoZoomPro/components/photo-mask.vue index 30b1941..971a14f 100644 --- a/src/components/VuePhotoZoomPro/PhotoMask.vue +++ b/src/components/VuePhotoZoomPro/components/photo-mask.vue @@ -88,7 +88,6 @@ export default { background-color: rgba(0,0,0,0.4); z-index: 1; } - .block { width: 30%; height: 50px; @@ -103,4 +102,4 @@ export default { clear: both; } } - + \ No newline at end of file diff --git a/src/components/VuePhotoZoomPro/components/selector.vue b/src/components/VuePhotoZoomPro/components/selector.vue new file mode 100644 index 0000000..4dd551e --- /dev/null +++ b/src/components/VuePhotoZoomPro/components/selector.vue @@ -0,0 +1,65 @@ + + + + + + \ No newline at end of file diff --git a/src/components/VuePhotoZoomPro/Zoomer.vue b/src/components/VuePhotoZoomPro/components/zoomer.vue similarity index 86% rename from src/components/VuePhotoZoomPro/Zoomer.vue rename to src/components/VuePhotoZoomPro/components/zoomer.vue index 6df44f5..51d9dd7 100644 --- a/src/components/VuePhotoZoomPro/Zoomer.vue +++ b/src/components/VuePhotoZoomPro/components/zoomer.vue @@ -13,11 +13,13 @@ class="position" :style="positionStyle" > - + + @@ -72,8 +74,7 @@ export default { return { transform: `scale(${this.scale}) translateZ(0)`, width: `${zoomRegion.width}px`, - height: `${zoomRegion.height}px`, - transformOrigin: 'left top' + height: `${zoomRegion.height}px` } } } @@ -83,9 +84,8 @@ export default { + \ No newline at end of file diff --git a/src/components/VuePhotoZoomPro/plugins/img/img-preview.vue b/src/components/VuePhotoZoomPro/plugins/img/img-preview.vue new file mode 100644 index 0000000..17b174b --- /dev/null +++ b/src/components/VuePhotoZoomPro/plugins/img/img-preview.vue @@ -0,0 +1,21 @@ + + + \ No newline at end of file diff --git a/src/components/VuePhotoZoomPro/plugins/img/img-zoomer.vue b/src/components/VuePhotoZoomPro/plugins/img/img-zoomer.vue new file mode 100644 index 0000000..cf5717a --- /dev/null +++ b/src/components/VuePhotoZoomPro/plugins/img/img-zoomer.vue @@ -0,0 +1,21 @@ + + + \ No newline at end of file diff --git a/src/components/VuePhotoZoomPro/plugins/img/index.js b/src/components/VuePhotoZoomPro/plugins/img/index.js new file mode 100644 index 0000000..4b571b0 --- /dev/null +++ b/src/components/VuePhotoZoomPro/plugins/img/index.js @@ -0,0 +1,7 @@ +import ImgPreview from './img-preview.vue' +import ImgZoomer from './img-zoomer.vue' + +export { + ImgPreview, + ImgZoomer +} \ No newline at end of file diff --git a/src/components/VuePhotoZoomPro/util.js b/src/components/VuePhotoZoomPro/util/index.js similarity index 100% rename from src/components/VuePhotoZoomPro/util.js rename to src/components/VuePhotoZoomPro/util/index.js