Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><em><strong>Option 1 :</em></strong></p> <p>From Shmiddty's post, a programmatic approach to referencing with 2d context:</p> <pre><code>function Shape(can) { this.x = 0; this.y = 0; this.width = 0; this.height = 0; this.fill = "rgba(0,0,0,0)"; this.parent = can; this.draw = function(ctx) { if (!$(me.parent).is(':visible')) return; var parts = me.fill.split(','); parts[3] = $(me.parent).css("opacity") + ')'; me.fill = parts.join(','); ctx.fillStyle = me.fill; ctx.fillRect(me.x, me.y, me.width, me.height); }; var me = this; } (function() { var can = $("#sandbox")[0], ctx = can.getContext('2d'), wid = can.width, hei = can.height, sha = new Shape($('&lt;div id="box"/&gt;').appendTo('body')); sha.x = 0; sha.y = 0; sha.width = 50; sha.height = 50; sha.offsetWidth = 50; sha.offsetHeight = 50; sha.fill = "rgba(000,111,222,1)"; (function draw(){ ctx.clearRect(0,0,wid,hei); sha.draw(ctx); webkitRequestAnimationFrame(draw); })(); $(can).click(function(){ $(sha.parent).fadeToggle(); }); $('#box').click(function(){ $(this).fadeToggle(); }); })();​ </code></pre> <p><em><strong>Option 2 :</em></strong> </p> <p>I was able to track x,y coords from click and touch events by applying CSS to a hidden DOM element. </p> <p><strong>Calling a bootstrap popover :</strong> </p> <pre><code>$("#canvas").click(function(e) { var x = e.pageX; var y = e.pageY; if ($.inArray(x, coords['shape1']) !== -1 || $.inArray(y, coords['shape1']) !== -1){ $("#myObj").css({'position':'absolute','top':y,'left':x}).popover({ trigger: 'click', placement:'top', }).popover('show'); } }); stage.update(); </code></pre> <p><strong>HTML:</strong></p> <pre><code>&lt;canvas id="canvas" width="375" height="322"&gt;&lt;/canvas&gt; &lt;span class="myObj" data-content="lorem ipsum content" data-original-title="pop-title"&gt;&lt;/span&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload