From 273158c6af33cdf6fc5e39cacb2b6f1f04bce32c Mon Sep 17 00:00:00 2001 From: joannacirillo Date: Wed, 15 Jun 2022 18:40:01 +0200 Subject: [PATCH] refactor(remoteview): refactor constructor refactor constructor to call setters at instanciation --- Sources/Rendering/Misc/RemoteView/index.js | 25 ++++++++++++---------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/Sources/Rendering/Misc/RemoteView/index.js b/Sources/Rendering/Misc/RemoteView/index.js index 1845ee1b189..42db0be0c6c 100644 --- a/Sources/Rendering/Misc/RemoteView/index.js +++ b/Sources/Rendering/Misc/RemoteView/index.js @@ -187,21 +187,24 @@ function vtkRemoteView(publicAPI, model) { // Object factory // ---------------------------------------------------------------------------- -const DEFAULT_VALUES = { - viewId: '-1', - interactiveQuality: 60, - interactiveRatio: 1 / window.devicePixelRatio, - stillQuality: 100, - stillRatio: 1, - rpcMouseEvent: 'viewport.mouse.interaction', - rpcGestureEvent: null, - rpcWheelEvent: null, -}; +function defaultValues(initialValues) { + return { + viewId: '-1', + interactiveQuality: 60, + interactiveRatio: 1 / window.devicePixelRatio, + stillQuality: 100, + stillRatio: 1, + rpcMouseEvent: 'viewport.mouse.interaction', + rpcGestureEvent: null, + rpcWheelEvent: null, + ...initialValues, + }; +} // ---------------------------------------------------------------------------- export function extend(publicAPI, model, initialValues = {}) { - Object.assign(model, DEFAULT_VALUES, initialValues); + Object.assign(initialValues, defaultValues(initialValues)); macro.obj(publicAPI, model, initialValues); macro.get(publicAPI, model, [