From 2cd9276dd5973e40395f02ab8470815e15fab631 Mon Sep 17 00:00:00 2001 From: Raya Straus Date: Mon, 3 Jan 2022 08:00:54 +0200 Subject: [PATCH] fix unsharpMask strength fromJson --- __TESTS__/unit/fromJson/adjust.fromJson.test.ts | 2 +- src/actions/effect/EffectActions/SimpleEffectAction.ts | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/__TESTS__/unit/fromJson/adjust.fromJson.test.ts b/__TESTS__/unit/fromJson/adjust.fromJson.test.ts index cee9cd6f..f9996d0f 100644 --- a/__TESTS__/unit/fromJson/adjust.fromJson.test.ts +++ b/__TESTS__/unit/fromJson/adjust.fromJson.test.ts @@ -4,7 +4,7 @@ describe('adjust.fromJson', () => { it('should generate a url with adjust actions from array of models', function () { const transformation = fromJson([ { actionType: 'improve', mode: 'outdoor', blend: 30}, - { actionType: 'unsharpMask', level: 50}, + { actionType: 'unsharpMask', strength: 50}, { actionType: 'saturation', level: 40} ]); diff --git a/src/actions/effect/EffectActions/SimpleEffectAction.ts b/src/actions/effect/EffectActions/SimpleEffectAction.ts index 3e7e3b6a..5c481aeb 100644 --- a/src/actions/effect/EffectActions/SimpleEffectAction.ts +++ b/src/actions/effect/EffectActions/SimpleEffectAction.ts @@ -33,12 +33,13 @@ class SimpleEffectAction extends Action { } static fromJson(actionModel: IActionModel): SimpleEffectAction { - const {actionType, level} = (actionModel as IEffectActionWithLevelModel); + const {actionType, level, strength} = (actionModel as IEffectActionWithLevelModel); const effectType = ACTION_TYPE_TO_EFFECT_MODE_MAP[actionType] || actionType; // We are using this() to allow inheriting classes to use super.fromJson.apply(this, [actionModel]) // This allows the inheriting classes to determine the class to be created - const result = new this(effectType, level); + // @ts-ignore + const result = new this(effectType, level ? level : strength); return result; }