Skip to content

Commit e262302

Browse files
Applying SketchAPI changes to public repo.
1 parent 74fbc50 commit e262302

File tree

5 files changed

+24
-11
lines changed

5 files changed

+24
-11
lines changed

.eslintrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
"MSDocumentData": "readonly",
5454
"MSSymbolMaster": "readonly",
5555
"MSSymbolInstance": "readonly",
56-
"MSAvailableOverride": "readonly",
56+
"MSOverridePoint": "readonly",
5757
"MSAssetLibrary": "readonly",
5858
"MSDocument": "readonly",
5959
"NSURL": "readonly",

SketchAPI.xcodeproj/xcshareddata/xcschemes/Sketch API.xcscheme

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "1340"
3+
LastUpgradeVersion = "1500"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"

Source/dom/models/DataOverride.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ if (typeof MSDataOverride !== 'undefined') {
1818

1919
DataOverride.define('override', {
2020
get() {
21-
const wrapped = Override.fromNative(this._object.availableOverride())
21+
const wrapped = Override.fromNative(this._object.overridePoint())
2222
Object.defineProperty(wrapped, '__symbolInstance', {
2323
writable: false,
2424
enumerable: false,

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

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -121,18 +121,31 @@ test('should handle image override', (_context, document) => {
121121

122122
// add the instance to the page
123123
document.selectedPage.layers = document.selectedPage.layers.concat(instance)
124-
expect(instance.overrides.length).toBe(1)
125-
expect(instance.overrides[0].property).toBe('image')
124+
expect(instance.overrides.length).toBe(2)
125+
126+
// check image resize behavior
127+
expect(instance.overrides[0].property).toBe('imageResizeBehavior')
126128
expect(instance.overrides[0].isDefault).toBe(true)
127-
expect(instance.overrides[0].value.type).toBe('ImageData')
129+
expect(instance.overrides[0].value).toBe('Original')
128130

129-
instance.overrides[0].value = {
131+
instance.overrides[0].value = '1'
132+
133+
expect(instance.overrides[0].property).toBe('imageResizeBehavior')
134+
expect(instance.overrides[0].isDefault).toBe(false)
135+
expect(instance.overrides[0].value).toBe('1')
136+
137+
// check image
138+
expect(instance.overrides[1].property).toBe('image')
139+
expect(instance.overrides[1].isDefault).toBe(true)
140+
expect(instance.overrides[1].value.type).toBe('ImageData')
141+
142+
instance.overrides[1].value = {
130143
base64: base64Image2,
131144
}
132145

133-
expect(instance.overrides[0].property).toBe('image')
134-
expect(instance.overrides[0].isDefault).toBe(false)
135-
expect(instance.overrides[0].value.type).toBe('ImageData')
146+
expect(instance.overrides[1].property).toBe('image')
147+
expect(instance.overrides[1].isDefault).toBe(false)
148+
expect(instance.overrides[1].value.type).toBe('ImageData')
136149
})
137150

138151
test('hidden layers should not be editable', (_context, document) => {

Source/settings/Settings.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ function getNativeStorageObject(layer) {
9191
if (!layer._isWrappedObject) {
9292
object = layer
9393
} else if (layer.type === 'DataOverride') {
94-
object = layer.sketchObject.availableOverride().overrideValue()
94+
object = layer.sketchObject.overridePoint().overrideValue()
9595
} else if (layer.type === 'Override') {
9696
object = layer.sketchObject.overrideValue()
9797
} else {

0 commit comments

Comments
 (0)