Permalink
Browse files

Set fixedRadius in makeRectShapeLayer (#69)

  • Loading branch information...
1 parent 5ff80ed commit 0b3a29457538354152729b38df4b38acd41346b0 @dchen dchen committed with jongold May 3, 2017
Showing with 24 additions and 20 deletions.
  1. +1 −0 __tests__/jsonUtils/shapeLayers.js
  2. +23 −20 src/jsonUtils/shapeLayers.js
@@ -37,6 +37,7 @@ describe('makeRectShapeLayer', () => {
expect(shapeLayer).toHaveProperty('frame.y', 200);
expect(shapeLayer).toHaveProperty('frame.width', 300);
expect(shapeLayer).toHaveProperty('frame.height', 400);
+ expect(shapeLayer).toHaveProperty('fixedRadius', 10);
});
});
@@ -133,26 +133,29 @@ export const makeRectShapeLayer = (
width: number,
height: number,
radii: Radii = [0, 0, 0, 0],
-) => ({
- _class: 'rectangle',
- do_objectID: generateID(),
- frame: makeRect(x, y, width, height),
- isFlippedHorizontal: false,
- isFlippedVertical: false,
- isLocked: false,
- isVisible: true,
- layerListExpandedType: 0,
- name: 'Path',
- nameIsFixed: false,
- resizingType: 0,
- rotation: 0,
- shouldBreakMaskChain: false,
- booleanOperation: -1,
- edited: false,
- path: makeRectPath(radii),
- fixedRadius: 8,
- hasConvertedToNewRoundCorners: true,
-});
+) => {
+ const fixedRadius = radii[0] || 0;
+ return {
+ _class: 'rectangle',
+ do_objectID: generateID(),
+ frame: makeRect(x, y, width, height),
+ isFlippedHorizontal: false,
+ isFlippedVertical: false,
+ isLocked: false,
+ isVisible: true,
+ layerListExpandedType: 0,
+ name: 'Path',
+ nameIsFixed: false,
+ resizingType: 0,
+ rotation: 0,
+ shouldBreakMaskChain: false,
+ booleanOperation: -1,
+ edited: false,
+ path: makeRectPath(radii),
+ fixedRadius,
+ hasConvertedToNewRoundCorners: true,
+ };
+};
export const makeShapeGroup = (
frame: SJRect,

0 comments on commit 0b3a294

Please sign in to comment.