title: KonvaJS - How to add shape with button trigger?
body: <p>Sorry for bad grammar-</p>
  
  <p>i have a problem about how to add shape with button trigger.
  but isn't working</p>
  
  <p>here my code :
  HTML </p>
  
  <pre><code>&lt;button id="btnCreateRectangle" class="btn-primary-blue"&gt;Button Text&lt;/button&gt;
  </code></pre>
  
  <p>And here my js :</p>
  
  <pre><code>
          function addRectangle(layer) {
              var scale = 1;
  
              var rectangle = new Konva.Rect({
                  x: 12,
                  y: 12,
                  numPoints: 5,
                  innerRadius: 30,
                  outerRadius: 50,
                  fill: "#89b717",
                  opacity: 0.8,
                  draggable: true,
                  name: 'rect',
                  width: 128,
                  height: 50,
                  scale: {
                      x: scale,
                      y: scale
                  },
                  shadowColor: "black",
                  shadowBlur: 4,
                  shadowOffset: {
                      x: 5,
                      y: 5
                  },
                  shadowOpacity: 0.6,
                  // custom attribute
                  startScale: scale
              });
  
              layer.add(rectangle);
          }
  </code></pre>
  
  <pre><code>document
              .getElementById('btnCreateRectangle')
              .addEventListener('click', function () {
                  addRectangle(layer)
              });
  </code></pre>
  
  <p>Im very pretty new in javasrcipt language , 
  any suggest or answer will be appreciate</p>
  
  <p>thanks</p>