Forum

[SOLVED] object clicked event capture via api?

04 May 2016 13:53 #9228
in your main.js how can capture if an object are clicked?, thx.

I want to combine it with Magnific Popup libraries (or shadowbox or lightbox or lightcase, etc).
04 May 2016 17:43 #9236
var m_app  = require("app");
var m_data = require("data");
var m_anim = require("animation");
var m_scenes = require("scenes");


function init_cb(canvas_elem, success) {
……
canvas_elem.addEventListener("mousedown", main_canvas_click, false);
}


function main_canvas_click(e) {
if (e.preventDefault)
e.preventDefault();

var x = e.clientX;
var y = e.clientY;

var obj = m_scenes.pick_object(x, y);

if (obj) {
var n = obj.name;
if (n == 'pelota_05') {
$.magnificPopup.open({
items: {
type:'inline',
src: '<div class="white-popup" data-effect="mfp-zoom-in">Punto de explicacion 01</div>',
}
});
}
}
}
 
Please register or log in to leave a reply.