Skip to content

Commit 81aad17

Browse files
committed
fix component
1 parent ba8f330 commit 81aad17

3 files changed

Lines changed: 26 additions & 15 deletions

File tree

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './mouse-cursor-shape';

src/common/components/mock-components/front-components/mouse-cursor/mouse-cursor-shape.tsx

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1-
import { forwardRef } from 'react';
2-
import { Group, Path } from 'react-konva';
3-
import { ShapeSizeRestrictions, ShapeType } from '@/core/model';
1+
import { forwardRef, useEffect, useState, useRef } from 'react';
2+
import { Group, Image } from 'react-konva';
3+
import { ShapeSizeRestrictions, ShapeType, BASE_ICONS_URL } from '@/core/model';
44
import { ShapeProps } from '../../shape.model';
55
import { BASIC_SHAPE } from '../shape.const';
66
import { useShapeProps } from '../../../shapes/use-shape-props.hook';
77
import { useGroupShapeProps } from '../../mock-components.utils';
88
import { fitSizeToShapeSizeRestrictions } from '@/common/utils/shapes/shape-restrictions';
99
import { returnIconSize } from './icon-shape.business';
10+
import { loadSvgWithFill } from '@/common/utils/svg.utils';
1011

1112
const MouseCursorSizeRestrictions: ShapeSizeRestrictions = {
1213
minWidth: 25,
@@ -44,8 +45,6 @@ export const MouseCursorShape = forwardRef<any, ShapeProps>((props, ref) => {
4445
iconHeight
4546
);
4647

47-
console.log(iconWidth, iconHeight);
48-
4948
const { width: restrictedWidth, height: restrictedHeight } = restrictedSize;
5049

5150
const { stroke } = useShapeProps(otherProps, BASIC_SHAPE);
@@ -57,17 +56,29 @@ export const MouseCursorShape = forwardRef<any, ShapeProps>((props, ref) => {
5756
ref
5857
);
5958

59+
const [image, setImage] = useState<HTMLImageElement | null>(null);
60+
const imageRef = useRef(null);
61+
62+
const fileName = 'cursor.svg';
63+
64+
useEffect(() => {
65+
loadSvgWithFill(`${BASE_ICONS_URL}${fileName}`, `${stroke}`).then(img => {
66+
setImage(img);
67+
});
68+
}, []);
69+
6070
return (
6171
<Group {...commonGroupProps} {...shapeProps}>
62-
<Path
63-
scaleX={restrictedWidth}
64-
scaleY={restrictedHeight}
65-
x={0}
66-
y={0}
67-
data="M166.59 134.1a1.91 1.91 0 0 1-.55-1.79a2 2 0 0 1 1.08-1.42l46.25-17.76l.24-.1A14 14 0 0 0 212.38 87L52.29 34.7A13.95 13.95 0 0 0 34.7 52.29L87 212.38a13.82 13.82 0 0 0 12.6 9.6h.69a13.84 13.84 0 0 0 12.71-8.37a2 2 0 0 0 .1-.24l17.76-46.25a2 2 0 0 1 3.21-.53l51.31 51.31a14 14 0 0 0 19.8 0l12.69-12.69a14 14 0 0 0 0-19.8Zm42.82 62.63l-12.68 12.68a2 2 0 0 1-2.83 0l-51.31-51.31a14 14 0 0 0-22.74 4.32a2 2 0 0 0-.1.24L102 208.91a2 2 0 0 1-3.61-.26L46.11 48.57a1.87 1.87 0 0 1 .47-2a1.92 1.92 0 0 1 1.35-.57a2.2 2.2 0 0 1 .64.1l160.08 52.28a2 2 0 0 1 .26 3.61l-46.25 17.76l-.24.1a14 14 0 0 0-4.32 22.74l51.31 51.31a2 2 0 0 1 0 2.83"
68-
stroke={stroke}
69-
fill={stroke}
70-
/>
72+
{image && (
73+
<Image
74+
image={image}
75+
x={0}
76+
y={0}
77+
width={restrictedWidth}
78+
height={restrictedHeight}
79+
ref={imageRef}
80+
/>
81+
)}
7182
</Group>
7283
);
7384
});

src/pods/canvas/model/inline-editable.model.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ const inlineEditableShapes = new Set<ShapeType>([
4141
'loading-indicator',
4242
'fileTree',
4343
'input-stepper',
44-
'mousecursor',
4544
]);
4645

4746
// Check if a shape type allows inline editing

0 commit comments

Comments
 (0)