Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Applying SketchAPI changes to public repo. #919

Merged
merged 2 commits into from
Nov 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"MSDocumentData": "readonly",
"MSSymbolMaster": "readonly",
"MSSymbolInstance": "readonly",
"MSAvailableOverride": "readonly",
"MSOverridePoint": "readonly",
"MSAssetLibrary": "readonly",
"MSDocument": "readonly",
"NSURL": "readonly",
Expand Down Expand Up @@ -157,7 +157,6 @@
"MSGradientAsset": "readonly",
"MSPersistentAssetCollection": "readonly",
"MSOverrideProperty": "readonly",
"MSOverridePoint": "readonly",
"NSMutableArray": "readonly",
"CGRectNull": "readonly",
"NSColorSpace": "readonly",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1340"
LastUpgradeVersion = "1500"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
2 changes: 1 addition & 1 deletion Source/dom/models/DataOverride.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ if (typeof MSDataOverride !== 'undefined') {

DataOverride.define('override', {
get() {
const wrapped = Override.fromNative(this._object.availableOverride())
const wrapped = Override.fromNative(this._object.overridePoint())
Object.defineProperty(wrapped, '__symbolInstance', {
writable: false,
enumerable: false,
Expand Down
27 changes: 20 additions & 7 deletions Source/dom/models/__tests__/Override.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,18 +121,31 @@ test('should handle image override', (_context, document) => {

// add the instance to the page
document.selectedPage.layers = document.selectedPage.layers.concat(instance)
expect(instance.overrides.length).toBe(1)
expect(instance.overrides[0].property).toBe('image')
expect(instance.overrides.length).toBe(2)

// check image resize behavior
expect(instance.overrides[0].property).toBe('imageResizeBehavior')
expect(instance.overrides[0].isDefault).toBe(true)
expect(instance.overrides[0].value.type).toBe('ImageData')
expect(instance.overrides[0].value).toBe('Original')

instance.overrides[0].value = {
instance.overrides[0].value = '1'

expect(instance.overrides[0].property).toBe('imageResizeBehavior')
expect(instance.overrides[0].isDefault).toBe(false)
expect(instance.overrides[0].value).toBe('1')

// check image
expect(instance.overrides[1].property).toBe('image')
expect(instance.overrides[1].isDefault).toBe(true)
expect(instance.overrides[1].value.type).toBe('ImageData')

instance.overrides[1].value = {
base64: base64Image2,
}

expect(instance.overrides[0].property).toBe('image')
expect(instance.overrides[0].isDefault).toBe(false)
expect(instance.overrides[0].value.type).toBe('ImageData')
expect(instance.overrides[1].property).toBe('image')
expect(instance.overrides[1].isDefault).toBe(false)
expect(instance.overrides[1].value.type).toBe('ImageData')
})

test('hidden layers should not be editable', (_context, document) => {
Expand Down
2 changes: 1 addition & 1 deletion Source/settings/Settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ function getNativeStorageObject(layer) {
if (!layer._isWrappedObject) {
object = layer
} else if (layer.type === 'DataOverride') {
object = layer.sketchObject.availableOverride().overrideValue()
object = layer.sketchObject.overridePoint().overrideValue()
} else if (layer.type === 'Override') {
object = layer.sketchObject.overrideValue()
} else {
Expand Down