I am trying to copy/paste the block on the mouse position but it pastes on (0,0) position each time
$(document).keydown(function(e){
if (e.keyCode == ctrlKey || e.keyCode == cmdKey) ctrlDown = true;
if (ctrlDown && e.keyCode == cKey) {
copyblockTypes = selectedList.map(block => block.blockType)
};
if (ctrlDown && (e.keyCode == vKey)) {
for (const block of copyblockTypes) {
console.log($('#'+block).parent().clone())
}
for (const block of copyblockTypes) {
newDraggable(
$('#'+block).parent().clone(),
{ top: e.pageY + 'px',
left: e.pageX + 'px' },
true,
0
);
}
correctPosition(block);
}
}).keyup(function(e){
if (e.keyCode == ctrlKey || e.keyCode == cmdKey) ctrlDown = false;
}
)
});
And when I am checking in my console left & top are not at the same position I don't know if it is a big deal (see image bellow)
Thanks
Key Event does not have x and y position. So you would need to add a mouse move event to get it.