Skip to content

Commit

Permalink
fix: fix some bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
zouhangwithsweet committed May 14, 2021
1 parent 87bb6c2 commit 0020558
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 47 deletions.
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
6 changes: 4 additions & 2 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

0 comments on commit 0020558

Please sign in to comment.