-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #462 from Lemoncode/dev
prod
- Loading branch information
Showing
48 changed files
with
721 additions
and
80 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
export interface E2E_CanvasItemKeyAttrs { | ||
x: number; | ||
y: number; | ||
['data-id']: string; | ||
width: number; | ||
height: number; | ||
shapeType: string; | ||
} |
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
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
3 changes: 2 additions & 1 deletion
3
src/common/components/mock-components/front-basic-shapes/index.ts
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
72 changes: 72 additions & 0 deletions
72
src/common/components/mock-components/front-basic-shapes/vertical-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,72 @@ | ||
import { forwardRef } from 'react'; | ||
import { Group, Line, Rect } from 'react-konva'; | ||
import { ShapeSizeRestrictions, ShapeType } from '@/core/model'; | ||
import { fitSizeToShapeSizeRestrictions } from '@/common/utils/shapes/shape-restrictions'; | ||
import { ShapeProps } from '../shape.model'; | ||
import { useShapeProps } from '../../shapes/use-shape-props.hook'; | ||
import { BASIC_SHAPE } from '../front-components/shape.const'; | ||
import { useGroupShapeProps } from '../mock-components.utils'; | ||
|
||
const verticalLineShapeRestrictions: ShapeSizeRestrictions = { | ||
minWidth: 10, | ||
minHeight: 50, | ||
maxWidth: 10, | ||
maxHeight: -1, | ||
defaultWidth: 10, | ||
defaultHeight: 200, | ||
}; | ||
|
||
export const getVerticalLineShapeRestrictions = (): ShapeSizeRestrictions => | ||
verticalLineShapeRestrictions; | ||
|
||
const shapeType: ShapeType = 'verticalLine'; | ||
|
||
export const VerticalLineShape = forwardRef<any, ShapeProps>((props, ref) => { | ||
const { | ||
x, | ||
y, | ||
width, | ||
height, | ||
id, | ||
onSelected, | ||
text, | ||
otherProps, | ||
...shapeProps | ||
} = props; | ||
const restrictedSize = fitSizeToShapeSizeRestrictions( | ||
verticalLineShapeRestrictions, | ||
width, | ||
height | ||
); | ||
|
||
const { width: restrictedWidth, height: restrictedHeight } = restrictedSize; | ||
|
||
const { stroke, strokeStyle } = useShapeProps(otherProps, BASIC_SHAPE); | ||
|
||
const commonGroupProps = useGroupShapeProps( | ||
props, | ||
restrictedSize, | ||
shapeType, | ||
ref | ||
); | ||
|
||
return ( | ||
<Group {...commonGroupProps} {...shapeProps}> | ||
{/* Transparent rectangle for applying margin */} | ||
<Rect | ||
width={restrictedWidth} | ||
height={restrictedHeight} | ||
fill="transparent" | ||
/> | ||
|
||
<Line | ||
x={restrictedWidth / 2} //TODO: alber delete. solo referencia de line x={0} | ||
y={0} //TODO:alber delete. solo referencia de line y={restrictedHeight / 2} | ||
points={[0, 0, 0, restrictedHeight]} //TODO:alber delete. ??? seguramente necesita modificar: points={[0, 0, restrictedWidth, 0]} | ||
stroke={stroke} | ||
strokeWidth={2} | ||
dash={strokeStyle} | ||
/> | ||
</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.