diff --git a/public/smartcomponent/svg-layout-designer.ts b/public/smartcomponent/svg-layout-designer.ts index 07310c7..45a94f7 100644 --- a/public/smartcomponent/svg-layout-designer.ts +++ b/public/smartcomponent/svg-layout-designer.ts @@ -364,6 +364,7 @@ * @param index Position to insert the container * @param type Container type to create * @param callback + * @deprecated Do not use this function, use AddContainer instead */ public AddContainerToSelectedContainer(index: number, type: string, callback?: (state: IEditorState) => void) { const eventType = 'addContainerToSelectedContainer'; @@ -396,6 +397,7 @@ * Append a new container in the current selected container * @param type Container type to create * @param callback + * @deprecated Do not use this function, use AppendContainer instead */ public AppendContainerToSelectedContainer(type: string, callback?: (state: IEditorState) => void) { const eventType = 'appendContainerToSelectedContainer'; @@ -410,6 +412,7 @@ * Select a container by id * @param containerId Container's id to select * @param callback + * @deprecated Do not use this function */ public SelectContainer(containerId: string, callback?: (state: IEditorState) => void) { const eventType = 'selectContainer'; @@ -453,6 +456,7 @@ * Select a symbol by id * @param symbolId Symbol's id to select * @param callback + * @deprecated Do not use this function */ public SelectSymbol(symbolId: string, callback?: (state: IEditorState) => void) { const eventType = 'selectSymbol'; diff --git a/src/Events/EditorEvents.ts b/src/Events/EditorEvents.ts index 95d6dc8..45cd998 100644 --- a/src/Events/EditorEvents.ts +++ b/src/Events/EditorEvents.ts @@ -1,7 +1,6 @@ import { useEffect } from 'react'; import { - AddContainer as AddContainerAction, - AddContainerToSelectedContainer as AddContainerToSelectedContainerAction + AddContainer as AddContainerAction } from '../Components/Editor/Actions/AddContainer'; import { DeleteContainer as DeleteContainerAction @@ -35,13 +34,9 @@ export const events: IEditorEvent[] = [ { name: 'getCurrentHistoryState', func: GetCurrentHistoryState }, { name: 'appendNewState', func: AppendNewState }, { name: 'addContainer', func: AddContainer }, - // { name: 'addContainerToSelectedContainer', func: AddContainerToSelectedContainer }, { name: 'appendContainer', func: AppendContainer }, - // { name: 'appendContainerToSelectedContainer', func: AppendContainerToSelectedContainer }, - // { name: 'selectContainer', func: SelectContainer }, { name: 'deleteContainer', func: DeleteContainer }, { name: 'addSymbol', func: AddSymbol }, - // { name: 'selectSymbol', func: SelectSymbol }, { name: 'deleteSymbol', func: DeleteSymbol } ]; @@ -201,37 +196,6 @@ function AddContainer({ root.dispatchEvent(customEvent); } -// function AddContainerToSelectedContainer({ -// root, -// editorState, -// setNewHistory, -// eventInitDict -// }: IEditorEventParams): void { -// const { -// index, -// type -// } = eventInitDict?.detail; - -// const history = GetCurrentHistory(editorState.history, editorState.historyCurrentStep); -// const currentState = history[editorState.historyCurrentStep]; - -// const newHistory = AddContainerAction( -// index, -// type, -// currentState.selectedContainerId, -// editorState.configuration, -// history, -// editorState.historyCurrentStep -// ); -// setNewHistory(newHistory); - -// const customEvent = new CustomEvent( -// 'addContainerToSelectedContainer', -// { detail: structuredClone(editorState.history[editorState.historyCurrentStep]) } -// ); -// root.dispatchEvent(customEvent); -// } - function AppendContainer({ root, editorState, @@ -265,64 +229,6 @@ function AppendContainer({ root.dispatchEvent(customEvent); } -// function AppendContainerToSelectedContainer({ -// root, -// editorState, -// setNewHistory, -// eventInitDict -// }: IEditorEventParams): void { -// const { -// type -// } = eventInitDict?.detail; - -// const history = GetCurrentHistory(editorState.history, editorState.historyCurrentStep); -// const currentState = history[editorState.historyCurrentStep]; - -// const selected = FindContainerById(currentState.containers, currentState.selectedContainerId); - -// if (selected !== null && selected !== undefined) { -// setNewHistory(AddContainerToSelectedContainerAction( -// type, -// selected, -// editorState.configuration, -// history, -// editorState.historyCurrentStep -// )); -// } - -// const customEvent = new CustomEvent( -// 'appendContainerToSelectedContainer', -// { detail: structuredClone(editorState.history[editorState.historyCurrentStep]) } -// ); -// root.dispatchEvent(customEvent); -// } - -// function SelectContainer({ -// root, -// editorState, -// setNewHistory, -// eventInitDict -// }: IEditorEventParams): void { -// const { -// containerId -// } = eventInitDict?.detail; - -// const history = GetCurrentHistory(editorState.history, editorState.historyCurrentStep); - -// const newHistory = SelectContainerAction( -// containerId, -// history, -// editorState.historyCurrentStep -// ); -// setNewHistory(newHistory); - -// const customEvent = new CustomEvent( -// 'selectContainer', -// { detail: structuredClone(editorState.history[editorState.historyCurrentStep]) } -// ); -// root.dispatchEvent(customEvent); -// } - function DeleteContainer({ root, editorState, @@ -376,32 +282,6 @@ function AddSymbol({ root.dispatchEvent(customEvent); } -// function SelectSymbol({ -// root, -// editorState, -// setNewHistory, -// eventInitDict -// }: IEditorEventParams): void { -// const { -// symbolId -// } = eventInitDict?.detail; - -// const history = GetCurrentHistory(editorState.history, editorState.historyCurrentStep); - -// const newHistory = SelectSymbolAction( -// symbolId, -// history, -// editorState.historyCurrentStep -// ); -// setNewHistory(newHistory); - -// const customEvent = new CustomEvent( -// 'SelectSymbol', -// { detail: structuredClone(editorState.history[editorState.historyCurrentStep]) } -// ); -// root.dispatchEvent(customEvent); -// } - function DeleteSymbol({ root, editorState,