Implement minWidth property + refactor default property of new containers and main container (#34)
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
Co-authored-by: Eric NGUYEN <enguyen@techform.fr> Reviewed-on: https://git.siklos-chaneru.duckdns.org/Siklos/svg-layout-designer-react/pulls/34
This commit is contained in:
parent
60329ef143
commit
2945febd91
12 changed files with 137 additions and 44 deletions
|
@ -3,24 +3,67 @@ import { XPositionReference } from '../Enums/XPositionReference';
|
|||
|
||||
/**
|
||||
* Properties of a container
|
||||
* @property id id of the container
|
||||
* @property parentId id of the parent container
|
||||
* @property x horizontal offset of the container
|
||||
* @property y vertical offset of the container
|
||||
* @property isRigidBody if true apply rigid body behaviors
|
||||
* @property isAnchor if true apply anchor behaviors
|
||||
*/
|
||||
export default interface IProperties {
|
||||
/** id of the container */
|
||||
id: string
|
||||
|
||||
/** id of the parent container (null when there is no parent) */
|
||||
parentId: string | null
|
||||
|
||||
/** horizontal offset */
|
||||
x: number
|
||||
|
||||
/** vertical offset */
|
||||
y: number
|
||||
|
||||
/**
|
||||
* Minimum width (min=1)
|
||||
* Allows the container to set isRigidBody to false when it gets squeezed
|
||||
* by an anchor
|
||||
*/
|
||||
minWidth: number
|
||||
|
||||
/** width */
|
||||
width: number
|
||||
|
||||
/** height */
|
||||
height: number
|
||||
|
||||
/** true if rigid, false otherwise */
|
||||
isRigidBody: boolean
|
||||
|
||||
/** true if anchor, false otherwise */
|
||||
isAnchor: boolean
|
||||
|
||||
/** Horizontal alignment, also determines the visual location of x {Left = 0, Center, Right } */
|
||||
XPositionReference: XPositionReference
|
||||
|
||||
/**
|
||||
* (optional)
|
||||
* Replace a <rect> by a customized "SVG". It is not really an svg but it at least allows
|
||||
* to draw some patterns that can be bind to the properties of the container
|
||||
* Use {prop} to bind a property. Use {{ styleProp }} to use an object.
|
||||
* Example :
|
||||
* ```
|
||||
* `<rect width="{width}" height="{height}" style="{style}"></rect>
|
||||
* <rect width="{width}" height="{height}" stroke="black" fill-opacity="0"></rect>
|
||||
* <line x1="0" y1="0" x2="{width}" y2="{height}" stroke="black" style='{{ "transform":"scaleY(0.5)"}}'></line>
|
||||
* <line x1="{width}" y1="0" x2="0" y2="{height}" stroke="black" style='{userData.styleLine}'></line>
|
||||
* `
|
||||
* ```
|
||||
*/
|
||||
customSVG?: string
|
||||
|
||||
/**
|
||||
* (optional)
|
||||
* Style of the <rect>
|
||||
*/
|
||||
style?: React.CSSProperties
|
||||
|
||||
/**
|
||||
* (optional)
|
||||
* User data that can be used for data storage or custom SVG
|
||||
*/
|
||||
userData?: object
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue