-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into feature/#158-multiline-edition-to-listbox
- Loading branch information
Showing
65 changed files
with
1,368 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
47 changes: 47 additions & 0 deletions
47
src/common/components/front-basic-sapes/circle-basic-shape.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import { ShapeSizeRestrictions } from '@/core/model'; | ||
import { forwardRef } from 'react'; | ||
import { ShapeProps } from '../front-components/shape.model'; | ||
import { fitSizeToShapeSizeRestrictions } from '@/common/utils/shapes/shape-restrictions'; | ||
import { Circle, Group } from 'react-konva'; | ||
|
||
const circleShapeRestrictions: ShapeSizeRestrictions = { | ||
minWidth: 10, | ||
minHeight: 10, | ||
maxWidth: -1, | ||
maxHeight: -1, | ||
defaultWidth: 160, | ||
defaultHeight: 160, | ||
}; | ||
|
||
export const getCircleShapeSizeRestrictions = (): ShapeSizeRestrictions => | ||
circleShapeRestrictions; | ||
|
||
export const CircleShape = forwardRef<any, ShapeProps>( | ||
({ x, y, width, height, id, onSelected, ...shapeProps }, ref) => { | ||
const { width: restrictedWidth, height: restrictedHeight } = | ||
fitSizeToShapeSizeRestrictions(circleShapeRestrictions, width, height); | ||
|
||
const radius = Math.min(restrictedWidth, restrictedHeight) / 2; | ||
|
||
return ( | ||
<Group | ||
x={x} | ||
y={y} | ||
ref={ref} | ||
width={restrictedWidth} | ||
height={restrictedHeight} | ||
{...shapeProps} | ||
onClick={() => onSelected(id, 'circle')} | ||
> | ||
<Circle | ||
x={restrictedWidth / 2} | ||
y={restrictedHeight / 2} | ||
radius={radius} | ||
stroke="black" | ||
strokeWidth={2} | ||
fill="white" | ||
/> | ||
</Group> | ||
); | ||
} | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,6 @@ | ||
export * from './rectangle-basic-shape'; | ||
export * from './postit-basic-shape'; | ||
export * from './diamond-shape'; | ||
export * from './line-basic-shape'; | ||
export * from './circle-basic-shape'; | ||
export * from './star-shape'; |
51 changes: 51 additions & 0 deletions
51
src/common/components/front-basic-sapes/line-basic-shape.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import { forwardRef } from 'react'; | ||
import { Group, Line, Rect } from 'react-konva'; | ||
import { ShapeSizeRestrictions } from '@/core/model'; | ||
import { fitSizeToShapeSizeRestrictions } from '@/common/utils/shapes/shape-restrictions'; | ||
import { ShapeProps } from '../front-components/shape.model'; | ||
|
||
const lineShapeRestrictions: ShapeSizeRestrictions = { | ||
minWidth: 50, | ||
minHeight: 10, | ||
maxWidth: -1, | ||
maxHeight: 10, | ||
defaultWidth: 200, | ||
defaultHeight: 10, | ||
}; | ||
|
||
export const getlineShapeRestrictions = (): ShapeSizeRestrictions => | ||
lineShapeRestrictions; | ||
|
||
export const LineShape = forwardRef<any, ShapeProps>( | ||
({ x, y, width, height, id, onSelected, text, ...shapeProps }, ref) => { | ||
const { width: restrictedWidth, height: restrictedHeight } = | ||
fitSizeToShapeSizeRestrictions(lineShapeRestrictions, width, height); | ||
|
||
return ( | ||
<Group | ||
x={x} | ||
y={y} | ||
ref={ref} | ||
width={restrictedWidth} | ||
height={restrictedHeight} | ||
{...shapeProps} | ||
onClick={() => onSelected(id, 'line')} | ||
> | ||
{/* Transparent rectangle for applying margin */} | ||
<Rect | ||
width={restrictedWidth} | ||
height={restrictedHeight} | ||
fill="transparent" | ||
/> | ||
|
||
<Line | ||
x={0} | ||
y={restrictedHeight / 2} | ||
points={[0, 0, restrictedWidth, 0]} | ||
stroke="black" | ||
strokeWidth={2} | ||
/> | ||
</Group> | ||
); | ||
} | ||
); |
85 changes: 85 additions & 0 deletions
85
src/common/components/front-basic-sapes/postit-basic-shape.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
import { ShapeSizeRestrictions } from '@/core/model'; | ||
import { forwardRef } from 'react'; | ||
import { ShapeProps } from '../front-components/shape.model'; | ||
import { fitSizeToShapeSizeRestrictions } from '@/common/utils/shapes/shape-restrictions'; | ||
import { Group, Rect, Text } from 'react-konva'; | ||
|
||
const postItShapeRestrictions: ShapeSizeRestrictions = { | ||
minWidth: 80, | ||
minHeight: 80, | ||
maxWidth: -1, | ||
maxHeight: -1, | ||
defaultWidth: 160, | ||
defaultHeight: 160, | ||
}; | ||
|
||
export const getPostItShapeSizeRestrictions = (): ShapeSizeRestrictions => | ||
postItShapeRestrictions; | ||
|
||
export const PostItShape = forwardRef<any, ShapeProps>( | ||
({ x, y, width, height, id, text, onSelected, ...shapeProps }, ref) => { | ||
const { width: restrictedWidth, height: restrictedHeight } = | ||
fitSizeToShapeSizeRestrictions(postItShapeRestrictions, width, height); | ||
|
||
const handleClick = () => { | ||
onSelected(id, 'postit'); | ||
}; | ||
|
||
const postItWidth = restrictedWidth; | ||
const postItHeight = restrictedHeight; | ||
const tapeWidth = postItWidth * 0.4; | ||
const tapeHeight = postItHeight * 0.18; | ||
|
||
const tapeX = (width - tapeWidth) / 2; | ||
const tapeY = 0; | ||
|
||
const tapeRotation = -10; | ||
|
||
return ( | ||
<Group | ||
x={x} | ||
y={y} | ||
ref={ref} | ||
width={restrictedWidth} | ||
height={restrictedHeight} | ||
{...shapeProps} | ||
onClick={handleClick} | ||
> | ||
{/* Post-it frame */} | ||
<Rect | ||
x={0} | ||
y={10} | ||
width={postItWidth} | ||
height={restrictedHeight - 10} | ||
cornerRadius={10} | ||
stroke="black" | ||
strokeWidth={2} | ||
fill="#FFFF99" | ||
/> | ||
|
||
{/* Tape */} | ||
<Rect | ||
x={tapeX} | ||
y={tapeY} | ||
width={tapeWidth} | ||
height={tapeHeight} | ||
rotation={tapeRotation} | ||
stroke="black" | ||
strokeWidth={2} | ||
fill="gray" | ||
/> | ||
<Text | ||
x={5} | ||
y={tapeHeight + 5} | ||
width={postItWidth - 5} | ||
height={restrictedHeight - tapeHeight - 10} | ||
text={text} | ||
fontSize={18} | ||
fill="black" | ||
wrap="wrap" | ||
ellipsis={true} | ||
/> | ||
</Group> | ||
); | ||
} | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.