본문으로 건너뛰기

add()

설명

새로운 상태를 추가합니다

정보

새로운 상태 추가는 자동으로 이루어집니다. 따라서 이 메서드는 수동 사용에는 권장되지 않습니다.

사용법

add(newState: array): void;

매개변수

  • newState - (필수) 다이어그램의 현재 상태에 대한 JSON 객체 배열

예제

const editor = new dhx.DiagramEditor("editor_container", {
type: "default"
});
// ...
editor.history.add([
{ "id": "shape_1", "type": "start", "x": 200, y: 0, "text": "Start" },
{ "id": "shape_2", "type": "process", "x": 200, y: 120, "text": "Call the client" },
{ "id": "line_1", "type": "line", "from": "shape_1", "to": "shape_2" }
]);

변경 로그: v4.1에서 추가