From 92b87bdb49fafae0ef353f649840e235d56a83bc Mon Sep 17 00:00:00 2001 From: Tim Pettersen Date: Tue, 9 Jan 2018 14:15:29 +1100 Subject: [PATCH] Update for Sketch 48.x (add layer fill if not present) --- package-lock.json | 39 ++++++++++++++++++++------------------- package.json | 2 +- src/video.js | 5 ++++- 3 files changed, 25 insertions(+), 21 deletions(-) diff --git a/package-lock.json b/package-lock.json index b96321a..b4153d9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "sketch-gifme-plugin", - "version": "0.1.0", + "version": "0.2.1", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -2541,14 +2541,6 @@ } } }, - "string_decoder": { - "version": "1.0.1", - "bundled": true, - "dev": true, - "requires": { - "safe-buffer": "5.0.1" - } - }, "string-width": { "version": "1.0.2", "bundled": true, @@ -2559,6 +2551,14 @@ "strip-ansi": "3.0.1" } }, + "string_decoder": { + "version": "1.0.1", + "bundled": true, + "dev": true, + "requires": { + "safe-buffer": "5.0.1" + } + }, "stringstream": { "version": "0.0.5", "bundled": true, @@ -3961,7 +3961,8 @@ "sketch-polyfill-settimeout": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/sketch-polyfill-settimeout/-/sketch-polyfill-settimeout-0.2.0.tgz", - "integrity": "sha512-dQmS69ZEy+PfZ+pICDDA0og1QpUv1T+8qZhvgGmaWs3a0sxhQtyIIbAtLqIVLcSOtpXTNtxIHjPZamcdZsoUsw==" + "integrity": "sha512-dQmS69ZEy+PfZ+pICDDA0og1QpUv1T+8qZhvgGmaWs3a0sxhQtyIIbAtLqIVLcSOtpXTNtxIHjPZamcdZsoUsw==", + "dev": true }, "slash": { "version": "1.0.0", @@ -4046,15 +4047,6 @@ "xtend": "4.0.1" } }, - "string_decoder": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz", - "integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==", - "dev": true, - "requires": { - "safe-buffer": "5.1.1" - } - }, "string-width": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", @@ -4088,6 +4080,15 @@ } } }, + "string_decoder": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz", + "integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==", + "dev": true, + "requires": { + "safe-buffer": "5.1.1" + } + }, "strip-ansi": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", diff --git a/package.json b/package.json index 4f0f444..304124e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "sketch-gifme-plugin", - "version": "0.2.0", + "version": "0.2.1", "engines": { "sketch": ">=3.0" }, diff --git a/src/video.js b/src/video.js index 905626c..e8c63c7 100644 --- a/src/video.js +++ b/src/video.js @@ -12,7 +12,10 @@ let animateLoopStarted = false * @param [{NSImage}] frames */ function startVideoLayer (layer, frames) { - const fill = layer.style().fills().firstObject() + let fill = layer.style().fills().firstObject() + if (!fill) { + fill = layer.style().addStylePartOfType(0) + } fill.setFillType(4) fill.setPatternFillType(1) videoLayers.push({