File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -95,25 +95,25 @@ export default class SignatureCanvas extends Component {
9595 _resizeCanvas = ( ) => {
9696 let canvasProps = this . props . canvasProps || { }
9797 let { width, height} = canvasProps
98+ // don't resize if the canvas has fixed width and height
99+ if ( width && height ) {
100+ return
101+ }
98102
99- let ctx = this . _ctx
100103 let canvas = this . _canvas
101104 /* When zoomed out to less than 100%, for some very strange reason,
102105 some browsers report devicePixelRatio as less than 1
103106 and only part of the canvas is cleared then. */
104107 let ratio = Math . max ( window . devicePixelRatio || 1 , 1 )
105108
106- // only change width/height if none has been passed in as a prop
107109 if ( ! width ) {
108110 canvas . width = canvas . offsetWidth * ratio
109111 }
110112 if ( ! height ) {
111113 canvas . height = canvas . offsetHeight * ratio
112114 }
113- if ( ! width || ! height ) {
114- ctx . scale ( ratio , ratio )
115- this . clear ( )
116- }
115+ canvas . getContext ( '2d' ) . scale ( ratio , ratio )
116+ this . clear ( )
117117 }
118118
119119 _reset = ( ) => {
You can’t perform that action at this time.
0 commit comments