diff --git a/src/common/hooks/dragHelper.ts b/src/common/hooks/dragHelper.ts index a6dbbab..1d5e617 100644 --- a/src/common/hooks/dragHelper.ts +++ b/src/common/hooks/dragHelper.ts @@ -113,11 +113,14 @@ export default class DragHelper { private moveFlutter(x: number, y: number, d = 0, lazy = 0) { const { width, height, finallySize } = this.initial as TInitial let scale: string | null = null - if (!d) { + if (d) { if (width > finallySize) { scale = width - d >= finallySize ? `transform: scale(${(width - d) / width});` : null - } else scale = width + d <= finallySize ? `transform: scale(${(width + d) / width})` : null + } else { + scale = width + d <= finallySize ? `transform: scale(${(width + d) / width})` : null + } } + const options = [`left: ${x}px`, `top: ${y}px`, `width: ${width}px`, `height: ${height}px`] scale && options.push(scale) options.push(`transition: all ${lazy}s`) @@ -137,9 +140,7 @@ export default class DragHelper { this.dragging = false store.commit('setDraging', false) store.commit('selectItem', {}) - if (!this.cloneEl) { - return - } + if (!done) { const { pageX, offsetX, pageY, offsetY } = this.initial as TInitial this.changeStyle([`left: ${pageX - offsetX}px`, `top: ${pageY - offsetY}px`, 'transform: scale(1)', 'transition: all 0.3s']) diff --git a/src/common/hooks/mapGetters.ts b/src/common/hooks/mapGetters.ts new file mode 100644 index 0000000..98a3008 --- /dev/null +++ b/src/common/hooks/mapGetters.ts @@ -0,0 +1,13 @@ +import { ComputedRef, computed } from 'vue' +import { useStore } from 'vuex' + +export function useSetupMapGetters(strList: T[]) { + const mapData: Partial<{[x in T]: ComputedRef}> = {} + const getters = useStore().getters + + strList.forEach(val => { + mapData[val] = computed(() => getters[val]) + }) + + return mapData as {[x in T]: ComputedRef} +} diff --git a/src/common/methods/QiNiu.ts b/src/common/methods/QiNiu.ts index 18de8fd..35d59d0 100644 --- a/src/common/methods/QiNiu.ts +++ b/src/common/methods/QiNiu.ts @@ -15,7 +15,7 @@ interface Options { } export default { - upload: async (file: File, options: Options, cb?: IQiniuSubscribeCb) => { + upload: async (file: File | Blob, options: Options, cb?: IQiniuSubscribeCb) => { const win = window let name = '' const suffix = file.type.split('/')[1] || 'png' // 文件后缀 diff --git a/src/common/methods/target.ts b/src/common/methods/target.ts index 90d1c60..163144a 100644 --- a/src/common/methods/target.ts +++ b/src/common/methods/target.ts @@ -8,7 +8,7 @@ // TODO: Group类型比较特殊,所以需要全量循环并判断是否为group const arr = ['w-text', 'w-image', 'w-svg', 'w-group', 'w-qrcode'] -export function getTarget(currentTarget: HTMLElement) { +export function getTarget(currentTarget: HTMLElement): Promise { let collector: string[] = [] let groupTarger: HTMLElement | null = null let saveTarger: HTMLElement | null = null diff --git a/src/components/business/image-cutout/ImageExtraction/ImageExtraction.vue b/src/components/business/image-cutout/ImageExtraction/ImageExtraction.vue deleted file mode 100644 index 111585d..0000000 --- a/src/components/business/image-cutout/ImageExtraction/ImageExtraction.vue +++ /dev/null @@ -1,107 +0,0 @@ - - - - - - diff --git a/src/components/business/picture-selector/index.vue b/src/components/business/picture-selector/index.vue index f67f707..421a25c 100644 --- a/src/components/business/picture-selector/index.vue +++ b/src/components/business/picture-selector/index.vue @@ -2,8 +2,8 @@ * @Author: ShawnPhang * @Date: 2022-10-08 10:07:19 * @Description: - * @LastEditors: ShawnPhang - * @LastEditTime: 2023-10-05 00:04:51 + * @LastEditors: ShawnPhang , Jeremy Yu + * @Date: 2024-03-04 18:10:00 -->