Skip to content

Commit

Permalink
fix: screen adaptation
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaohuoni committed Dec 16, 2019
1 parent cd98be5 commit 6c63d0f
Show file tree
Hide file tree
Showing 4 changed files with 787 additions and 3,598 deletions.
15 changes: 13 additions & 2 deletions packages/gesture-password-react/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,12 @@ export default class ReactGesturePassword extends React.Component<ReactGesturePa

createCanvasInstance(props: ReactGesturePasswordProps) {
if (!this.canvas) {
this.canvas = new GesturePassword({ ...props, el: this.el });
this.canvas = new GesturePassword({
...props,
el: this.el,
width: px2hd(props.width),
height: px2hd(props.height)
});
}
}

Expand Down Expand Up @@ -50,6 +55,12 @@ export default class ReactGesturePassword extends React.Component<ReactGesturePa
};

render() {
return <canvas ref={this.portalRef} width={px2hd(this.props.width)} height={px2hd(this.props.height)}></canvas>;
return (
<canvas
ref={this.portalRef}
width={px2hd(this.props.width)}
height={px2hd(this.props.height)}
></canvas>
);
}
}
7 changes: 6 additions & 1 deletion packages/gesture-password-vue/src/gesture-password.vue
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,12 @@ export default {
methods: {
createCanvasInstance(props) {
if (!this.canvas) {
const mergeProps = { ...props, onChange: this.$listeners.onChange };
const mergeProps = {
...props,
width: px2hd(props.width),
height: px2hd(props.height),
onChange: this.$listeners.onChange
};
this.canvas = new GesturePassword({ ...mergeProps, el: this.el });
}
},
Expand Down
Loading

0 comments on commit 6c63d0f

Please sign in to comment.