From 00205582825e16e10d06aafee5cac6bb430f5bec Mon Sep 17 00:00:00 2001 From: zouhang Date: Fri, 14 May 2021 10:23:41 +0800 Subject: [PATCH 1/3] fix: fix some bugs --- build/rollup/rollup-plugin-config.js | 1 + build/rollup/rollup-plugin-example-config.js | 1 + components/image-reader/image-processor.js | 82 +++++++++----------- components/stepper/index.vue | 6 +- 4 files changed, 43 insertions(+), 47 deletions(-) diff --git a/build/rollup/rollup-plugin-config.js b/build/rollup/rollup-plugin-config.js index d72e89df6..67103785e 100644 --- a/build/rollup/rollup-plugin-config.js +++ b/build/rollup/rollup-plugin-config.js @@ -133,6 +133,7 @@ const rollupPluginFactory = async () => { // inject replacePlugin({ 'process.env.NODE_ENV': `"${process.env.NODE_ENV}"`, + 'process.env.MAND_ENV': `"${process.env.NODE_ENV}"`, 'MAN_VERSION': `"${pkg.version}"` }), ...(conditionHelper(isTest, [ diff --git a/build/rollup/rollup-plugin-example-config.js b/build/rollup/rollup-plugin-example-config.js index a328b9282..9d65b8ce4 100644 --- a/build/rollup/rollup-plugin-example-config.js +++ b/build/rollup/rollup-plugin-example-config.js @@ -90,6 +90,7 @@ const rollupPluginFactory = async () => { // inject replacePlugin({ 'process.env.NODE_ENV': `"${process.env.NODE_ENV}"`, + 'process.env.MAND_ENV': `"${process.env.NODE_ENV}"`, 'MAN_VERSION': `"${pkg.version}"` }), svgSpritePlugin(), diff --git a/components/image-reader/image-processor.js b/components/image-reader/image-processor.js index decb3b7c1..226d011ac 100644 --- a/components/image-reader/image-processor.js +++ b/components/image-reader/image-processor.js @@ -127,52 +127,44 @@ function makeCanvas(img, orientation, maxWidth, maxHeight, quality) { ctx.drawImage(img, 0, 0, width, height) let base64 = null - if (CSS && CSS.supports && !CSS.supports('image-orientation:none')) { - switch (orientation) { - case 3: - ctx.rotate(180 * Math.PI / 180) - ctx.drawImage(img, -width, -height, width, height) - break - case 6: - ctx.rotate(90 * Math.PI / 180) - ctx.drawImage(img, 0, -width, height, width) - break - case 8: - ctx.rotate(270 * Math.PI / 180) - ctx.drawImage(img, -height, 0, height, width) - break - case 2: - ctx.translate(width, 0) - ctx.scale(-1, 1) - ctx.drawImage(img, 0, 0, width, height) - break - case 4: - ctx.translate(width, 0) - ctx.scale(-1, 1) - ctx.rotate(180 * Math.PI / 180) - ctx.drawImage(img, -width, -height, width, height) - break - case 5: - ctx.translate(width, 0) - ctx.scale(-1, 1) - ctx.rotate(90 * Math.PI / 180) - ctx.drawImage(img, 0, -width, height, width) - break - case 7: - ctx.translate(width, 0) - ctx.scale(-1, 1) - ctx.rotate(270 * Math.PI / 180) - ctx.drawImage(img, -height, 0, height, width) - break - default: - ctx.drawImage(img, 0, 0, width, height) - } - } else { - if ('5678'.includes(orientation)) { - ctx.drawImage(img, 0, 0, height, width) - } else { + switch (orientation) { + case 3: + ctx.rotate(180 * Math.PI / 180) + ctx.drawImage(img, -width, -height, width, height) + break + case 6: + ctx.rotate(90 * Math.PI / 180) + ctx.drawImage(img, 0, -width, height, width) + break + case 8: + ctx.rotate(270 * Math.PI / 180) + ctx.drawImage(img, -height, 0, height, width) + break + case 2: + ctx.translate(width, 0) + ctx.scale(-1, 1) + ctx.drawImage(img, 0, 0, width, height) + break + case 4: + ctx.translate(width, 0) + ctx.scale(-1, 1) + ctx.rotate(180 * Math.PI / 180) + ctx.drawImage(img, -width, -height, width, height) + break + case 5: + ctx.translate(width, 0) + ctx.scale(-1, 1) + ctx.rotate(90 * Math.PI / 180) + ctx.drawImage(img, 0, -width, height, width) + break + case 7: + ctx.translate(width, 0) + ctx.scale(-1, 1) + ctx.rotate(270 * Math.PI / 180) + ctx.drawImage(img, -height, 0, height, width) + break + default: ctx.drawImage(img, 0, 0, width, height) - } } if ((UA.oldIOS || UA.oldAndroid || UA.mQQBrowser || !navigator.userAgent) && window.JPEGEncoder) { diff --git a/components/stepper/index.vue b/components/stepper/index.vue index 3b2e58228..59aad9ba4 100644 --- a/components/stepper/index.vue +++ b/components/stepper/index.vue @@ -10,13 +10,15 @@ >
- + @blur="$_onChange" + />
Date: Fri, 14 May 2021 15:35:41 +0800 Subject: [PATCH 2/3] test: fix steper demo test --- .../stepper/test/__snapshots__/demo.spec.js.snap | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/components/stepper/test/__snapshots__/demo.spec.js.snap b/components/stepper/test/__snapshots__/demo.spec.js.snap index 31b7f6b92..6c5a8d429 100644 --- a/components/stepper/test/__snapshots__/demo.spec.js.snap +++ b/components/stepper/test/__snapshots__/demo.spec.js.snap @@ -14,7 +14,7 @@ exports[`Stepper - Demo Disabled 1`] = `
-
+
@@ -42,7 +42,7 @@ exports[`Stepper - Demo Minimum is -12 and maximum is 18 1`] = `
-
+
@@ -70,7 +70,7 @@ exports[`Stepper - Demo Minimum is 4 which is greater than default 1`] = `
-
+
@@ -98,7 +98,7 @@ exports[`Stepper - Demo Readonly 1`] = `
-
+
@@ -154,7 +154,7 @@ exports[`Stepper - Demo Step is a decimal, 1.3 1`] = `
-
+
From d5ef8aa945892e1fdf2bee08b802ba437b0258d0 Mon Sep 17 00:00:00 2001 From: zouhang Date: Fri, 14 May 2021 18:08:27 +0800 Subject: [PATCH 3/3] Bump up version to 2.5.19 --- CHANGELOG.en-US.md | 8 ++++++++ CHANGELOG.md | 9 +++++++++ components/stepper/index.vue | 2 +- package.json | 2 +- 4 files changed, 19 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.en-US.md b/CHANGELOG.en-US.md index b5f63f872..b6397ba38 100644 --- a/CHANGELOG.en-US.md +++ b/CHANGELOG.en-US.md @@ -3,6 +3,14 @@ title: Change Log toc: hidden --- +### 2.5.19 + +`2021-05-14` + +- Fix + - Fix the problem of incorrect image size modification by `image-reader` + - Fix the problem that `stepper` can't enter the decimal point + - Fix the problem that the `process.env.MAND_ENV` environment variable is not injected correctly ### 2.5.18 diff --git a/CHANGELOG.md b/CHANGELOG.md index 2ddc6e937..714e50401 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,15 @@ title: 更新日志 toc: hidden --- +### 2.5.19 + +`2021-05-14` + +- Fix + - 修复 `image-reader` 对图片尺寸修改不正确的问题 + - 修复 `stepper` 无法输入小数点的问题 + - 修复 `process.env.MAND_ENV` 环境变量没有正确注入的问题 + ### 2.5.18 `2021-04-02` diff --git a/components/stepper/index.vue b/components/stepper/index.vue index 59aad9ba4..bd3a69f69 100644 --- a/components/stepper/index.vue +++ b/components/stepper/index.vue @@ -262,7 +262,7 @@ export default { .md-stepper-number margin 0 4px - min-width stepper-width-input + width stepper-width-input height stepper-height padding 0 4px text-align center diff --git a/package.json b/package.json index eee54eb31..e5d289bdb 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "mand-mobile", - "version": "2.5.18", + "version": "2.5.19", "description": "A Vue.js 2.0 Mobile UI Toolkit", "homepage": "https://didi.github.io/mand-mobile", "main": "lib/mand-mobile.umd.js",