added table position

This commit is contained in:
Jan Prochazka 2020-12-26 16:10:26 +01:00
parent 96a52750e2
commit 1090d4effe

View File

@ -20,20 +20,15 @@ export default function Designer({ value, onChange }) {
var data = e.dataTransfer.getData('app_object_drag_data');
e.preventDefault();
if (!data) return;
const rect = e.target.getBoundingClientRect();
var json = JSON.parse(data);
json.designerId = uuidv1();
json.left = e.clientX;
json.top = e.clientY;
json.left = e.clientX - rect.left;
json.top = e.clientY - rect.top;
onChange({
...value,
tables: [...(tables || []), json],
});
// var objs = AppObject.createAppObjectInstances(json);
// let targetOffset = $(ev.target).offset();
// for (let obj of objs) {
// await this.props.model.addTable(obj, ev.clientX - targetOffset.left, ev.clientY - targetOffset.top);
// }
// this.changedModel();
};
const changeTable = React.useCallback(