add default properties

This commit is contained in:
casperlamboo 2017-11-23 14:23:53 +01:00
parent 726127323c
commit 687b95604b

View File

@ -1,4 +1,5 @@
import shortid from 'shortid'; import shortid from 'shortid';
import { SHAPE_TYPE_PROPERTIES } from '../constants/shapeTypeProperties.js';
export default function docToShapeData(docData) { export default function docToShapeData(docData) {
const sketchData = { const sketchData = {
@ -14,7 +15,8 @@ export default function docToShapeData(docData) {
for (const object of spaceData.objects) { for (const object of spaceData.objects) {
const UID = shortid.generate(); const UID = shortid.generate();
objectIds.push(UID); objectIds.push(UID);
sketchData.objectsById[UID] = { ...object, UID, space }; const { defaultProperties } = SHAPE_TYPE_PROPERTIES[object.type];
sketchData.objectsById[UID] = { ...defaultProperties, ...object, UID, space };
} }
sketchData.spaces[space] = { sketchData.spaces[space] = {