Skip to content

Commit

Permalink
fix: initial style didn't give any effect (#2504)
Browse files Browse the repository at this point in the history
  • Loading branch information
berviantoleo authored Jan 12, 2024
1 parent d1fb811 commit 657e8d9
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
3 changes: 3 additions & 0 deletions examples/demo/src/components/Default.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ export default function Default(): JSX.Element {
id: "1",
rect: { x1: 0.0, y1: 0.0, x2: 0.2, y2: 0.2 },
rectPx: {},
style: {
borderColor: "green",
},
},
],
}}
Expand Down
20 changes: 20 additions & 0 deletions packages/react-multi-crop/src/ReactMultiCrop/ReactMultiCrop.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,26 @@ class ReactMultiCrop extends Component<IReactMultiCropProps, IReactMultiCropStat
};
let totalRendered = 0;
for (const coord of inputObject) {
if (coord.style) {
if (coord.style.cropBackgroundColor) {
attribute.cropBackgroundColor = coord.style.cropBackgroundColor;
}
if (coord.style.cropBackgroundOpacity) {
attribute.cropBackgroundOpacity = coord.style.cropBackgroundOpacity;
}
if (coord.style.borderColor) {
attribute.borderColor = coord.style.borderColor;
}
if (coord.style.cornerColor) {
attribute.cornerColor = coord.style.cornerColor;
}
if (coord.style.cornerSize) {
attribute.cornerSize = coord.style.cornerSize;
}
if (coord.style.transparentCorners) {
attribute.transparentCorners = coord.style.transparentCorners;
}
}
const rect = this.createObject(canvas, coord, attribute, readonly || false);
if (rect) {
canvas.add(rect);
Expand Down

0 comments on commit 657e8d9

Please sign in to comment.