Here ya go! on('ready',()=>{
on('add:card',(o)=>{
_.defer(()=>{
const gridSize=(getObj('page',o.get('pageid'))||{get:()=>1}).get('snapping_increment')*70;
let w=o.get('width'),
h=o.get('height'),
x=(Math.floor((o.get('left')-(w/2))/gridSize)*gridSize)+(w/2),
y=(Math.floor((o.get('top')-(h/2))/gridSize)*gridSize)+(h/2);
o.set({
isdrawing:false,
top: y,
left: x
});
});
});
});
This even respects if you change the size of the grid. =D