@@ -120,6 +120,7 @@ const ReactCanvasSketch: React.FunctionComponent<ReactCanvasSketchProps> = (
120120 // already initialized, bail
121121 return ;
122122 }
123+ console . log ( "useEffect: Initializing" ) ;
123124
124125 const {
125126 backgroundImageUrl,
@@ -167,6 +168,7 @@ const ReactCanvasSketch: React.FunctionComponent<ReactCanvasSketchProps> = (
167168 if ( canvasSketch == null ) {
168169 return ;
169170 }
171+ console . log ( "useEffect: dimensions of container or canvas change" ) ;
170172 canvasSketch . redrawCurrentState ( ) ;
171173 } , [
172174 canvasSketch ,
@@ -181,32 +183,32 @@ const ReactCanvasSketch: React.FunctionComponent<ReactCanvasSketchProps> = (
181183 if ( canvasSketch == null ) {
182184 return ;
183185 }
184-
186+ console . log ( "useEffect: current object index or objects changes" ) ;
185187 canvasSketch . redrawSketchAt ( props . value . objects , props . value . currentObjectIndex ) ;
186188 } , [
187189 canvasSketch ,
188190 props . value . currentObjectIndex ,
189191 props . value . objects ,
190192 ] ) ;
191193
192- const { redrawIncrement } = props ;
193194 // redraw the sketch canvas when redraw increment changes
194195 useEffect ( ( ) => {
195196 if ( canvasSketch == null ) {
196197 return ;
197198 }
198-
199+ console . log ( "useEffect: redrawIncrement changes" ) ;
199200 canvasSketch . redrawSketch ( ) ;
200201 } , [
201202 canvasSketch ,
202- redrawIncrement ,
203+ props . redrawIncrement ,
203204 ] ) ;
204205
205206 // redraw the background image when it changes
206207 useEffect ( ( ) => {
207208 if ( canvasSketch == null ) {
208209 return ;
209210 }
211+ console . log ( "useEffect: background image when it changes" ) ;
210212 canvasSketch . redrawBackgroundImageUsing ( props . backgroundImageUrl ) ;
211213 } , [
212214 props . backgroundImageUrl ,
@@ -218,6 +220,7 @@ const ReactCanvasSketch: React.FunctionComponent<ReactCanvasSketchProps> = (
218220 if ( canvasSketch == null ) {
219221 return ;
220222 }
223+ console . log ( "useEffect: on added stroke when changes" ) ;
221224 canvasSketch . setOnAddedToolStroke ( props . onAddedStroke ) ;
222225 } , [
223226 props . onAddedStroke ,
@@ -229,6 +232,7 @@ const ReactCanvasSketch: React.FunctionComponent<ReactCanvasSketchProps> = (
229232 if ( canvasSketch == null ) {
230233 return ;
231234 }
235+ console . log ( "useEffect: tool color when it changes" ) ;
232236 canvasSketch . setToolColor ( props . toolColor ) ;
233237 } , [
234238 props . toolColor ,
@@ -240,6 +244,7 @@ const ReactCanvasSketch: React.FunctionComponent<ReactCanvasSketchProps> = (
240244 if ( canvasSketch == null ) {
241245 return ;
242246 }
247+ console . log ( "useEffect: tool width when it changes" ) ;
243248 canvasSketch . setToolWidth ( props . toolWidth ) ;
244249 } , [
245250 props . toolWidth ,
@@ -251,6 +256,7 @@ const ReactCanvasSketch: React.FunctionComponent<ReactCanvasSketchProps> = (
251256 if ( canvasSketch == null ) {
252257 return ;
253258 }
259+ console . log ( "useEffect: selected tool when it changes" ) ;
254260 canvasSketch . setSelectedTool ( props . canvasToolType ) ;
255261 } , [
256262 props . canvasToolType ,
0 commit comments