123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- import { getElementId, randomCode, deepCopy } from "../../plugins/utils";
- import { getModel as createLines } from "../lines/model";
- const COMPOSITION_PROP = {
- type: "COMPOSITION",
- sign: "subjective",
- topicNo: null,
- topicName: "",
- };
- const MODEL = {
- type: "COMPOSITION",
- x: 0,
- y: 0,
- w: 0,
- h: 350,
- minHeight: 60,
- sign: "subjective",
- topicNo: null,
- isCovered: false,
-
- isLast: true,
-
- isExtend: false,
-
- showTitle: true,
-
- serialNumber: 0,
-
-
- elements: [],
-
- parent: {},
- };
- const getModel = () => {
- return {
- id: getElementId(),
- key: randomCode(),
- ...COMPOSITION_PROP,
- };
- };
- const getFullModel = (compositionProp) => {
- const parent = { ...compositionProp };
- let model = {
- id: getElementId(),
- key: randomCode(),
- ...deepCopy(MODEL),
- };
- model.w = parent.w;
- model.parent = parent;
- model.topicNo = parent.topicNo;
- let linesModel = createLines();
- linesModel.lineCount = 5;
- linesModel.h = linesModel.lineCount * (linesModel.lineSpacing + 3);
- linesModel.w = parent.w;
- linesModel.container = {
- id: model.id,
- type: model.type,
- };
- model.h = linesModel.h + 50;
- model.elements.push(linesModel);
- return model;
- };
- export { MODEL, getModel, getFullModel };
|