Skip to content

Commit 119ceed

Browse files
committed
Update with release/2025.1-7b9e09e9
1 parent d666c08 commit 119ceed

File tree

7 files changed

+19
-40
lines changed

7 files changed

+19
-40
lines changed

Source/dom/__tests__/import.test.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,15 @@ test('should create Group from an SVG', () => {
88

99
const group = createLayerFromData(svgString, 'svg')
1010
expect(group.type).toEqual('Group')
11+
expect(group.groupBehavior).toEqual(2) // Graphic
1112
expect(group.layers.length).toEqual(1)
1213
expect(group.layers[0].type).toEqual('ShapePath')
1314
expect(group.layers[0].shapeType).toEqual('Rectangle')
1415
expect(group.layers[0].frame.width).toEqual(200)
1516
expect(group.layers[0].frame.height).toEqual(100)
1617
})
1718

18-
test('should create shape from a PDF', (_context, document) => {
19+
test('should create group from a PDF', (_context, document) => {
1920
const layer = new Shape({
2021
parent: document.selectedPage,
2122
frame: new Rectangle(0, 0, 200, 100),
@@ -32,7 +33,7 @@ test('should create shape from a PDF', (_context, document) => {
3233
output: null,
3334
})
3435
const imported = createLayerFromData(buffer, 'pdf')
35-
expect(imported.type).toEqual('ShapePath')
36+
expect(imported.type).toEqual('Group')
3637
expect(imported.frame.width).toEqual(200)
3738
expect(imported.frame.height).toEqual(100)
3839
})

Source/dom/layers/Text.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { DefinedPropertiesKey } from '../WrappedObject'
2+
import { FlexSizing } from './Layer'
23
import { StyledLayer } from './StyledLayer'
34
import { Rectangle } from '../models/Rectangle'
45
import { Types } from '../enums'
@@ -266,9 +267,11 @@ Text.define('fixedWidth', {
266267
return
267268
}
268269
if (fixed) {
269-
this._object.setTextBehaviour(TextBehaviour.fixedWidth)
270+
this.horizontalSizing = FlexSizing.Fixed
271+
this.verticalSizing = FlexSizing.Fit
270272
} else {
271-
this._object.setTextBehaviour(TextBehaviour.flexibleWidth)
273+
this.horizontalSizing = FlexSizing.Fit
274+
this.verticalSizing = FlexSizing.Fit
272275
}
273276
},
274277
})

Source/dom/layers/__tests__/SymbolInstance.test.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ test('should have overrides', (_context, document) => {
3434
document.selectedPage.layers = document.selectedPage.layers.concat(instance)
3535
instance.sketchObject.ensureDetachHasUpdated()
3636

37-
expect(instance.overrides.length).toBe(11)
37+
expect(instance.overrides.length).toBe(10)
38+
3839
const override = instance.overrides.find(o => o.property === 'stringValue')
3940
const result = {
4041
type: 'Override',

Source/dom/layers/__tests__/SymbolMaster.test.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ test('should create a symbol master with a nested symbol', (_context, document)
142142
test('should have overrides', (_context, document) => {
143143
const { master, text } = createSymbolMaster(document)
144144

145-
expect(master.overrides.length).toBe(9)
145+
expect(master.overrides.length).toBe(10)
146146
const override = master.overrides.find(o => o.property === 'stringValue')
147147
const result = {
148148
type: 'Override',
@@ -157,7 +157,8 @@ test('should have overrides', (_context, document) => {
157157
selected: false,
158158
}
159159
delete result.affectedLayer.selected
160-
result.affectedLayer.style = master.overrides[0].affectedLayer.style.toJSON()
160+
const overrideAfter = master.overrides.find(o => o.property === 'stringValue')
161+
result.affectedLayer.style = overrideAfter.affectedLayer.style.toJSON()
161162
expect(override.toJSON()).toEqual(result)
162163
})
163164

Source/dom/models/CurvePoint.js

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -76,30 +76,7 @@ CurvePoint.define('cornerRadius', {
7676
if (parent) {
7777
parent.setEdited(true)
7878
parent.adjustFrameAfterEditIntegral(false)
79-
80-
if (parent.isKindOfClass(MSRectangleShape)) {
81-
// Rectangle shapes have a `fixedRadius` property we need to manually update
82-
// to the first point's radius (sketch-hq/SketchAPI#775, #39183).
83-
const firstPoint = parent.points().firstObject()
84-
85-
if (firstPoint === this._object) {
86-
// We changed the first point, so we need to update the fixed radius.
87-
parent.setFixedRadius(cornerRadius)
88-
} else {
89-
// The inspector only updates if we change the fixed radius. Since we haven't
90-
// changed it in this case, we need to manually reload the current inspector.
91-
const document = Document.getSelectedDocument()
92-
if (document) {
93-
const inspectorController = document.sketchObject.inspectorController()
94-
if (inspectorController) {
95-
const currentController = inspectorController.currentController()
96-
if (currentController) {
97-
currentController.prepareForDisplay()
98-
}
99-
}
100-
}
101-
}
102-
}
79+
parent.propagateCornerRadiusToStyle()
10380
}
10481
},
10582
})

Source/dom/models/__tests__/CurvePoint.test.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,6 @@ test('should be able to modify the corner radius of a rectangle\'s CurvePoint',
4141
rectangle.points[1].cornerRadius = cornerRadius
4242
expect(toArray(rectangle.sketchObject.CSSAttributes()).join(''))
4343
.toEqual('border-radius: 0 ' + cornerRadius + 'px 0 0;')
44-
expect(rectangle.sketchObject.fixedRadius())
45-
.toEqual(0)
4644
})
4745

4846
test('should be able to modify the corner radius of a rectangle\'s first CurvePoint', () => {
@@ -52,8 +50,6 @@ test('should be able to modify the corner radius of a rectangle\'s first CurvePo
5250
rectangle.points[0].cornerRadius = cornerRadius
5351
expect(toArray(rectangle.sketchObject.CSSAttributes()).join(''))
5452
.toEqual('border-radius: ' + cornerRadius + 'px 0 0 0;')
55-
expect(rectangle.sketchObject.fixedRadius())
56-
.toEqual(cornerRadius)
5753
})
5854

5955
// sketch-hq/SketchAPI#775, #39183.
@@ -64,7 +60,7 @@ test('should be able to modify the corner radius of every rectangle\'s CurvePoin
6460
rectangle.points.forEach(point => point.cornerRadius = cornerRadius)
6561
expect(toArray(rectangle.sketchObject.CSSAttributes()).join(''))
6662
.toEqual('border-radius: ' + cornerRadius + 'px;')
67-
expect(rectangle.sketchObject.fixedRadius())
63+
expect(rectangle.sketchObject.cornerRadius())
6864
.toEqual(cornerRadius)
6965
})
7066

Source/dom/models/__tests__/Override.test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ test('should be able to set overrides', (_context, document) => {
3232
const instance = master.createNewInstance()
3333
document.selectedPage.layers = document.selectedPage.layers.concat(instance)
3434

35-
expect(instance.overrides.length).toBe(11)
35+
expect(instance.overrides.length).toBe(10)
3636

3737
// find the override point for the text layer's string value
3838
const override = instance.overrides.find(o => o.property === 'stringValue')
@@ -43,7 +43,7 @@ test('should be able to set overrides', (_context, document) => {
4343
// override
4444
override.value = 'overridden'
4545

46-
expect(instance.overrides.length).toBe(11)
46+
expect(instance.overrides.length).toBe(10)
4747
const result = {
4848
type: 'Override',
4949
id: `${text.id}_stringValue`,
@@ -135,7 +135,7 @@ test('should handle image override', (_context, document) => {
135135

136136
// add the instance to the page
137137
document.selectedPage.layers = document.selectedPage.layers.concat(instance)
138-
expect(instance.overrides.length).toBe(7)
138+
expect(instance.overrides.length).toBe(6)
139139

140140
// check image resize behavior
141141
const imageResizeOverride = instance.overrides.find(o => o.property === 'imageResizeBehavior')
@@ -168,7 +168,7 @@ test('hidden layers still editable', (_context, document) => {
168168
document.selectedPage.layers = document.selectedPage.layers.concat(instance)
169169

170170
// Update for 51800 - overrides should be available in hidden layers
171-
expect(instance.overrides.length).toBe(11)
171+
expect(instance.overrides.length).toBe(10)
172172
})
173173

174174
test('should be able to select an override', (_context, document) => {

0 commit comments

Comments
 (0)