Skip to content

开源白板工具(SaaS),一体化白板,包含思维导图、流程图、自由画等。All in one open-source whiteboard tool with mind, flowchart, freehand and etc.

fix(freehand): prevent from hitting the freehand when click the center of closed freehand which does not include fill property and cancel default fill for closed freehand in themes FreehandThemeColors (#376)

pubuzhixing8f7b818bee1c2
diff --git a/packages/drawnix/src/plugins/freehand/type.ts b/packages/drawnix/src/plugins/freehand/type.ts
index d674bc9..3d62a95 100644
--- a/packages/drawnix/src/plugins/freehand/type.ts
+++ b/packages/drawnix/src/plugins/freehand/type.ts
@@ -4,27 +4,27 @@ import { PlaitCustomGeometry } from '@plait/draw';
export const FreehandThemeColors = {
[ThemeColorMode.default]: {
strokeColor: DEFAULT_COLOR,
- fill: '#FFFFFF'
+ fill: 'none'
},
[ThemeColorMode.colorful]: {
strokeColor: '#06ADBF',
- fill: '#CDEFF2'
+ fill: 'none'
},
[ThemeColorMode.soft]: {
strokeColor: '#6D89C1',
- fill: '#DADFEB'
+ fill: 'none'
},
[ThemeColorMode.retro]: {
strokeColor: '#E9C358',
- fill: '#F6EDCF'
+ fill: 'none'
},
[ThemeColorMode.dark]: {
strokeColor: '#FFFFFF',
- fill: '#434343'
+ fill: 'none'
},
[ThemeColorMode.starry]: {
strokeColor: '#42ABE5',
- fill: '#163F5A'
+ fill: 'none'
}
};
diff --git a/packages/drawnix/src/plugins/freehand/utils.ts b/packages/drawnix/src/plugins/freehand/utils.ts
index f29f4ae..6caf6b7 100644
--- a/packages/drawnix/src/plugins/freehand/utils.ts
+++ b/packages/drawnix/src/plugins/freehand/utils.ts
@@ -43,7 +43,8 @@ export const isHitFreehand = (
) => {
const antiPoint = rotateAntiPointsByElement(board, point, element) || point;
const points = element.points;
- if (isClosedPoints(element.points)) {
+ const fill = getFillByElement(board, element);
+ if (isClosedPoints(element.points) && fill && fill !== 'none') {
return (
isPointInPolygon(antiPoint, points) || isHitPolyLine(points, antiPoint)
);