+ Start a Discussion
Vijay sidaraddiVijay sidaraddi 

lightning task: Suggestions on a locker services issue on a Digital Signature component

Hi All,
We were facing an issue in lightning component for a ‘Digital Signature’ component, where we replaced the following code to the below one in order to fix one locker services issue:
 
<canvas> in component before locker service was enabled:
<canvas id="PsignatureCanvas" class="box" />        (Previous line of code-before locker)
 
<canvas> in component change we’ve done after enabling locker service is:
<canvas aura:id="PsignatureCanvas" class="box"/>  (New changed line of code-after locker enabled)
 
 
Previous line of code in Renderer (was working fine with locker disabled):
                        Var canvas = document.getElementById("PsignatureCanvas");         // returning console value as -       [object HTMLCanvasElement]
                        Var context = canvas.getContext("2d");                                             //returning console value as -                 [object CanvasRenderingContext2D]
 
New locker fixing line of code in Renderer (changed to fix locker issue):
                        Var canvas = component.find('PsignatureCanvas');               // returning console value as -             SecureComponent: markup://aura:html {12315:0} {PsignatureCanvas}{ key: {"namespace":"c"} }
                        Var context = canvas.getContext("2d");                                        
     // showing error -                  
This page has an error. [canvas.getContext is not a function]


Thanks
Vijaykumar