JSFiddle - React, Tailwind, and code Playground
by Nick Hulea
JavaScript
function onMouseDown(event) {
r = new Raster({
source: 'http://cdn.eyahuska.com/two.jpg',
position: view.bounds
});
rArray.push(r);
r.on('load', function () {
loaded = true;
onResize();
});
l = project.importSVG(document.getElementById('logo'));
lgroup = l.children.triangle;
dArray.push(lgroup);
//console.log(dArray);
g = new Group([l, r]);
g.clipped = true;
dArray.position = event.point;
console.log(dArray);
if (dArray.length > 0) {
dArray.forEach(function (dArrays) {
for (var i = 0; i < dArrays.children.length; i++) {
for (var j = 0; j < dArrays.children.length; j++) {
showIntersections(dArrays.children[j], dArrays.children[i])
}
}
});
}
}
function showIntersections(path1, path2) {
var intersections = path1.getIntersections(path2);
console.log(intersections);
// intersections.position = event.point;
for (var i = 0; i < intersections.length; i++) {
new Path.Circle({
center: intersections[i].point,
radius: 3,
fillColor: '#009dec'
}).removeOnMove();
}
}
function onMouseMove(event) {
//setTimeout(
//function(){
lgroup.position = event.point;
//},100);
}