Canvas: Add symbol selector
This commit is contained in:
parent
bdc10264d5
commit
9cf56b308b
5 changed files with 140 additions and 39 deletions
|
@ -6,12 +6,13 @@ import { USE_EXPERIMENTAL_CANVAS_API } from '../../utils/default';
|
|||
import { FindContainerById, MakeRecursionDFSIterator } from '../../utils/itertools';
|
||||
import { BAR_WIDTH } from '../Bar/Bar';
|
||||
import { Canvas } from '../Canvas/Canvas';
|
||||
import { RenderSelector } from '../Canvas/Selector';
|
||||
import { RenderContainerSelector } from '../Canvas/SelectorContainer';
|
||||
import { SelectorMode, SVG } from '../SVG/SVG';
|
||||
import { useState } from 'react';
|
||||
import { type ISymbolModel } from '../../Interfaces/ISymbolModel';
|
||||
import { RenderContainers, RenderContainerDimensions, RenderSymbols } from '../Canvas/Renderer';
|
||||
import { RenderContainer } from '../Canvas/Container';
|
||||
import { RenderSymbolSelector } from '../Canvas/SelectorSymbol';
|
||||
|
||||
interface IViewerProps {
|
||||
className: string
|
||||
|
@ -106,14 +107,27 @@ export function Viewer({
|
|||
current.containers,
|
||||
leftDim, bottomDim, topDim, rightDim, scale);
|
||||
|
||||
// Draw selector
|
||||
RenderSelector(ctx, frameCount, {
|
||||
containers: current.containers,
|
||||
scale,
|
||||
selected: selectedContainer
|
||||
});
|
||||
// Draw symbols and symbol dimensions
|
||||
RenderSymbols(ctx, current, scale);
|
||||
|
||||
// Draw selector
|
||||
switch (selectorMode) {
|
||||
case SelectorMode.Containers:
|
||||
RenderContainerSelector(ctx, frameCount, {
|
||||
containers: current.containers,
|
||||
scale,
|
||||
selected: selectedContainer
|
||||
});
|
||||
break;
|
||||
case SelectorMode.Symbols:
|
||||
RenderSymbolSelector(ctx, frameCount, {
|
||||
symbols: current.symbols,
|
||||
scale,
|
||||
selected: selectedSymbol
|
||||
});
|
||||
break;
|
||||
}
|
||||
|
||||
ctx.restore();
|
||||
}
|
||||
return (
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue