File tree 1 file changed +6
-6
lines changed
1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -86,25 +86,25 @@ export default class SignatureCanvas extends Component {
86
86
_resizeCanvas = ( ) => {
87
87
let canvasProps = this . props . canvasProps || { }
88
88
let { width, height} = canvasProps
89
+ // don't resize if the canvas has fixed width and height
90
+ if ( width && height ) {
91
+ return
92
+ }
89
93
90
- let ctx = this . _ctx
91
94
let canvas = this . _canvas
92
95
/* When zoomed out to less than 100%, for some very strange reason,
93
96
some browsers report devicePixelRatio as less than 1
94
97
and only part of the canvas is cleared then. */
95
98
let ratio = Math . max ( window . devicePixelRatio || 1 , 1 )
96
99
97
- // only change width/height if none has been passed in as a prop
98
100
if ( ! width ) {
99
101
canvas . width = canvas . offsetWidth * ratio
100
102
}
101
103
if ( ! height ) {
102
104
canvas . height = canvas . offsetHeight * ratio
103
105
}
104
- if ( ! width || ! height ) {
105
- ctx . scale ( ratio , ratio )
106
- this . clear ( )
107
- }
106
+ canvas . getContext ( '2d' ) . scale ( ratio , ratio )
107
+ this . clear ( )
108
108
}
109
109
110
110
_reset = ( ) => {
You can’t perform that action at this time.
0 commit comments