WIP
This commit is contained in:
parent
532151b939
commit
62abd3ff03
4 changed files with 85 additions and 4 deletions
|
@ -8,6 +8,7 @@ import Swal from 'sweetalert2';
|
|||
import { PropertyType } from '../../../Enums/PropertyType';
|
||||
import { TransformX, TransformY } from '../../../utils/svg';
|
||||
import { Orientation } from '../../../Enums/Orientation';
|
||||
import { AddContainers, AddContainerToSelectedContainer } from './AddContainer';
|
||||
|
||||
/**
|
||||
* Select a container
|
||||
|
@ -109,6 +110,68 @@ export function DeleteContainer(
|
|||
return history;
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace a container
|
||||
* @param containerId containerId of the container to delete
|
||||
* @param fullHistory History of the editor
|
||||
* @param historyCurrentStep Current step
|
||||
* @returns New history
|
||||
*/
|
||||
// export function ReplaceByContainer(
|
||||
// containerId: string,
|
||||
// newContainerId: string,
|
||||
// fullHistory: IHistoryState[],
|
||||
// historyCurrentStep: number
|
||||
// ): IHistoryState[] {
|
||||
// const history = GetCurrentHistory(fullHistory, historyCurrentStep);
|
||||
// const current = history[history.length - 1];
|
||||
//
|
||||
//
|
||||
// const containers = structuredClone(current.containers);
|
||||
// const container = FindContainerById(containers, containerId);
|
||||
// if (container === undefined) {
|
||||
// throw new Error(`[ReplaceContainer] Tried to delete a container that is not present in the main container: ${containerId}`);
|
||||
// }
|
||||
// ///
|
||||
// const parent = FindContainerById(containers, container.properties.parentId);
|
||||
// if (parent === undefined || parent === null) {
|
||||
// throw new Error('[ReplaceContainer] Cannot replace a container that does not exists');
|
||||
// }
|
||||
//
|
||||
// const index = parent.children.indexOf(container.properties.id);
|
||||
//
|
||||
// const newHistoryAfterDelete = DeleteContainer(
|
||||
// container.properties.id,
|
||||
// history,
|
||||
// historyCurrentStep
|
||||
// );
|
||||
//
|
||||
// const newContainer = FindContainerById(containers, container.properties.parentId);
|
||||
//
|
||||
// AddContainerToSelectedContainer(
|
||||
// ne,
|
||||
// selected,
|
||||
// configuration,
|
||||
// history,
|
||||
// historyCurrentStep
|
||||
// );
|
||||
//
|
||||
//
|
||||
// /// /
|
||||
//
|
||||
//
|
||||
// history.push({
|
||||
// lastAction: `Replace ${containerId} By InsertnewId`,
|
||||
// mainContainer: current.mainContainer,
|
||||
// containers,
|
||||
// newContainerId,
|
||||
// typeCounters: Object.assign({}, current.typeCounters),
|
||||
// symbols: newSymbols,
|
||||
// selectedSymbolId: current.selectedSymbolId
|
||||
// });
|
||||
// return history;
|
||||
// }
|
||||
|
||||
/**
|
||||
* Returns the next container that will be selected
|
||||
* after the selectedContainer is removed.
|
||||
|
@ -371,9 +434,8 @@ function AssignProperty(container: IContainerModel, key: string, value: string |
|
|||
/**
|
||||
* Link a symbol to a container
|
||||
* @param containerId Container id
|
||||
* @param oldSymbolId Old Symbol id
|
||||
* @param newSymbolId New Symbol id
|
||||
* @param symbols Current list of symbols
|
||||
* @param oldSymbol
|
||||
* @param newSymbol
|
||||
* @returns
|
||||
*/
|
||||
export function LinkSymbol(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue