Implement events for external use + Rename interfaces with a I prefix + add some documentation (#26)
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
Implement events for external use Rename interfaces with a I prefix Add some documentation Co-authored-by: Eric NGUYEN <enguyen@techform.fr> Reviewed-on: https://git.siklos-chaneru.duckdns.org/Siklos/svg-layout-designer-react/pulls/26
This commit is contained in:
parent
6c601429b9
commit
c81a6fe44b
38 changed files with 228 additions and 116 deletions
|
@ -2,7 +2,7 @@ import { describe, expect, it, vi } from 'vitest';
|
|||
import * as React from 'react';
|
||||
import { fireEvent, render, screen } from '../../utils/test-utils';
|
||||
import { ElementsSidebar } from './ElementsSidebar';
|
||||
import { IContainerModel } from '../../Interfaces/ContainerModel';
|
||||
import { IContainerModel } from '../../Interfaces/IContainerModel';
|
||||
|
||||
describe.concurrent('Elements sidebar', () => {
|
||||
it('With a MainContainer', () => {
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
import * as React from 'react';
|
||||
import { motion } from 'framer-motion';
|
||||
import { Properties } from '../Properties/Properties';
|
||||
import ContainerProperties from '../../Interfaces/Properties';
|
||||
import { IContainerModel } from '../../Interfaces/ContainerModel';
|
||||
import ContainerProperties from '../../Interfaces/IProperties';
|
||||
import { IContainerModel } from '../../Interfaces/IContainerModel';
|
||||
import { getDepth, MakeIterator } from '../../utils/itertools';
|
||||
import { Menu } from '../Menu/Menu';
|
||||
import { MenuItem } from '../Menu/MenuItem';
|
||||
import { handleDragLeave, handleDragOver, handleLeftClick, handleOnDrop, handleRightClick } from './MouseEventHandlers';
|
||||
import { Point } from '../../Interfaces/Point';
|
||||
import { IPoint } from '../../Interfaces/IPoint';
|
||||
|
||||
interface IElementsSidebarProps {
|
||||
MainContainer: IContainerModel
|
||||
|
@ -64,7 +64,7 @@ export const ElementsSidebar: React.FC<IElementsSidebarProps> = (props: IElement
|
|||
// States
|
||||
const [isContextMenuOpen, setIsContextMenuOpen] = React.useState<boolean>(false);
|
||||
const [onClickContainerId, setOnClickContainerId] = React.useState<string>('');
|
||||
const [contextMenuPosition, setContextMenuPosition] = React.useState<Point>({
|
||||
const [contextMenuPosition, setContextMenuPosition] = React.useState<IPoint>({
|
||||
x: 0,
|
||||
y: 0
|
||||
});
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
import { IContainerModel } from '../../Interfaces/ContainerModel';
|
||||
import { Point } from '../../Interfaces/Point';
|
||||
import { IContainerModel } from '../../Interfaces/IContainerModel';
|
||||
import { IPoint } from '../../Interfaces/IPoint';
|
||||
import { findContainerById } from '../../utils/itertools';
|
||||
|
||||
export function handleRightClick(
|
||||
event: MouseEvent,
|
||||
setIsContextMenuOpen: React.Dispatch<React.SetStateAction<boolean>>,
|
||||
setOnClickContainerId: React.Dispatch<React.SetStateAction<string>>,
|
||||
setContextMenuPosition: React.Dispatch<React.SetStateAction<Point>>
|
||||
setContextMenuPosition: React.Dispatch<React.SetStateAction<IPoint>>
|
||||
): void {
|
||||
event.preventDefault();
|
||||
|
||||
|
@ -16,7 +16,7 @@ export function handleRightClick(
|
|||
return;
|
||||
}
|
||||
|
||||
const contextMenuPosition: Point = { x: event.pageX, y: event.pageY };
|
||||
const contextMenuPosition: IPoint = { x: event.pageX, y: event.pageY };
|
||||
setIsContextMenuOpen(true);
|
||||
setOnClickContainerId(event.target.id);
|
||||
setContextMenuPosition(contextMenuPosition);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue