Skip to content

Commit

Permalink
Applying SketchAPI changes to public repo.
Browse files Browse the repository at this point in the history
  • Loading branch information
SheffieldKevin committed Nov 22, 2023
1 parent 74fbc50 commit e262302
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .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
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

0 comments on commit e262302

Please sign in to comment.