async function addCircle(raio){
await svgCircle.push('<circle id="c'+circleCount+'" class="handle" cx="0" cy="0" r="'+raio+'" style="fill: dodgerblue;"/>')
var st = '<svg style="position: fixed;width: 100%;height: 100%;">'
for(let s of svgCircle){
st += await s;
}
st += await '</svg>'
divForAdd.innerHTML = await st;
await handles.push(document.getElementById("c"+circleCount));
await TweenLite.set(handles[circleCount], { x: 200, y: 100 })
drags.push(Draggable.create(handles[circleCount], {
onDrag: function() {
if(!loaded)return
...
},
onDragEnd: function (e) {
//see if the target overlaps with the element with ID "element2"
if (this.hitTest("#c" + (0))) {
...
}
}
}));
circleCount++;
}
Hi, i new in JS and Draggable. So, im trying to put some circles in svg tag but just the last elements works when i call more than one "addCircle". What i'm doing wrong? Sorry for the bad english.