Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
zouhangwithsweet committed May 14, 2021
2 parents 6a75337 + d5ef8aa commit a772c3e
Show file tree
Hide file tree
Showing 8 changed files with 67 additions and 54 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down
1 change: 1 addition & 0 deletions build/rollup/rollup-plugin-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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, [
Expand Down
1 change: 1 addition & 0 deletions build/rollup/rollup-plugin-example-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down
82 changes: 37 additions & 45 deletions components/image-reader/image-processor.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
8 changes: 5 additions & 3 deletions components/stepper/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@
>
</div>
<div class="md-stepper-number">
<input type="tel"
<input
:type="!isInteger ? 'number' :'tel'"
:size="contentLength"
:value="currentNum"
:readOnly="readOnly"
@input="$_onInput"
@focus="$_onFocus"
@blur="$_onChange">
@blur="$_onChange"
/>
</div>
<div
class="md-stepper-button md-stepper-button-add"
Expand Down Expand Up @@ -260,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
Expand Down
10 changes: 5 additions & 5 deletions components/stepper/test/__snapshots__/demo.spec.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ exports[`Stepper - Demo Disabled 1`] = `
<div class="md-field-item-right">
<div class="md-stepper disabled">
<div class="md-stepper-button md-stepper-button-reduce"></div>
<div class="md-stepper-number"><input type="tel" size="2" value="0"></div>
<div class="md-stepper-number"><input type="number" size="2" value="0"></div>
<div class="md-stepper-button md-stepper-button-add"></div>
</div>
<!---->
Expand Down Expand Up @@ -42,7 +42,7 @@ exports[`Stepper - Demo Minimum is -12 and maximum is 18 1`] = `
<div class="md-field-item-right">
<div class="md-stepper">
<div class="md-stepper-button md-stepper-button-reduce"></div>
<div class="md-stepper-number"><input type="tel" size="2" value="0"></div>
<div class="md-stepper-number"><input type="number" size="2" value="0"></div>
<div class="md-stepper-button md-stepper-button-add"></div>
</div>
<!---->
Expand Down Expand Up @@ -70,7 +70,7 @@ exports[`Stepper - Demo Minimum is 4 which is greater than default 1`] = `
<div class="md-field-item-right">
<div class="md-stepper">
<div class="md-stepper-button md-stepper-button-reduce"></div>
<div class="md-stepper-number"><input type="tel" size="2" value="0"></div>
<div class="md-stepper-number"><input type="number" size="2" value="0"></div>
<div class="md-stepper-button md-stepper-button-add"></div>
</div>
<!---->
Expand Down Expand Up @@ -98,7 +98,7 @@ exports[`Stepper - Demo Readonly 1`] = `
<div class="md-field-item-right">
<div class="md-stepper">
<div class="md-stepper-button md-stepper-button-reduce"></div>
<div class="md-stepper-number"><input type="tel" size="2" readOnly="true" value="0"></div>
<div class="md-stepper-number"><input type="number" size="2" readOnly="true" value="0"></div>
<div class="md-stepper-button md-stepper-button-add"></div>
</div>
<!---->
Expand Down Expand Up @@ -154,7 +154,7 @@ exports[`Stepper - Demo Step is a decimal, 1.3 1`] = `
<div class="md-field-item-right">
<div class="md-stepper">
<div class="md-stepper-button md-stepper-button-reduce"></div>
<div class="md-stepper-number"><input type="tel" size="2" value="0"></div>
<div class="md-stepper-number"><input type="number" size="2" value="0"></div>
<div class="md-stepper-button md-stepper-button-add"></div>
</div>
<!---->
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down

0 comments on commit a772c3e

Please sign in to comment.