-
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/-#167-create-text-container-section-…
…in-right-components-panel # Conflicts: # src/core/model/index.ts # src/pods/canvas/canvas.model.ts # src/pods/canvas/shape-renderer/index.tsx
- Loading branch information
Showing
78 changed files
with
1,127 additions
and
153 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
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.
Binary file not shown.
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.
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.
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
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
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
71 changes: 71 additions & 0 deletions
71
src/common/components/front-basic-sapes/large-arrow-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,71 @@ | ||
import { Group, Path } from 'react-konva'; | ||
import { ShapeSizeRestrictions } from '@/core/model'; | ||
import { forwardRef, useMemo } from 'react'; | ||
import { ShapeProps } from '../front-components/shape.model'; | ||
import { fitSizeToShapeSizeRestrictions } from '@/common/utils/shapes/shape-restrictions'; | ||
|
||
const LargeArrowShapeSizeRestrictions: ShapeSizeRestrictions = { | ||
minWidth: 50, | ||
minHeight: 50, | ||
maxWidth: -1, | ||
maxHeight: -1, | ||
defaultWidth: 100, | ||
defaultHeight: 100, | ||
}; | ||
|
||
const LARGE_ARROW_FIX_WIDTH = 100; | ||
const LARGE_ARROW_FIX_HEIGHT = 100; | ||
|
||
const pathData = `M10,35 L200,35 L200,15 L300,50 L200,85 L200,65 L10,65 Z`; | ||
|
||
export const getLargeArrowShapeSizeRestrictions = (): ShapeSizeRestrictions => | ||
LargeArrowShapeSizeRestrictions; | ||
export const LargeArrowShape = forwardRef<any, ShapeProps>( | ||
({ x, y, width, height, id, onSelected, otherProps, ...shapeProps }, ref) => { | ||
const { width: restrictedWidth, height: restrictedHeight } = | ||
fitSizeToShapeSizeRestrictions( | ||
LargeArrowShapeSizeRestrictions, | ||
width, | ||
height | ||
); | ||
|
||
const scaleX = useMemo(() => { | ||
return restrictedWidth / LARGE_ARROW_FIX_WIDTH; | ||
}, [restrictedWidth]); | ||
|
||
const scaleY = useMemo(() => { | ||
return restrictedHeight / LARGE_ARROW_FIX_HEIGHT; | ||
}, [restrictedHeight]); | ||
|
||
const stroke = useMemo( | ||
() => otherProps?.stroke ?? 'black', | ||
[otherProps?.stroke] | ||
); | ||
|
||
const fill = useMemo( | ||
() => otherProps?.backgroundColor ?? 'white', | ||
[otherProps?.backgroundColor] | ||
); | ||
|
||
return ( | ||
<Group | ||
x={x} | ||
y={y} | ||
ref={ref} | ||
width={restrictedWidth} | ||
height={restrictedHeight} | ||
{...shapeProps} | ||
onClick={() => onSelected(id, 'largeArrow')} | ||
> | ||
<Group | ||
width={LARGE_ARROW_FIX_WIDTH} | ||
height={LARGE_ARROW_FIX_HEIGHT} | ||
scaleX={scaleX} | ||
scaleY={scaleY} | ||
> | ||
<Path data={pathData} fill={fill} stroke={stroke} strokeWidth={2} /> | ||
</Group> | ||
</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
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
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
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.