Skip to content

Commit 7f15397

Browse files
committed
refactor(remoteview): refactor constructor
refactor constructor to call setters at instanciation
1 parent 8fb9e8d commit 7f15397

File tree

1 file changed

+14
-11
lines changed
  • Sources/Rendering/Misc/RemoteView

1 file changed

+14
-11
lines changed

Sources/Rendering/Misc/RemoteView/index.js

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -187,21 +187,24 @@ function vtkRemoteView(publicAPI, model) {
187187
// Object factory
188188
// ----------------------------------------------------------------------------
189189

190-
const DEFAULT_VALUES = {
191-
viewId: '-1',
192-
interactiveQuality: 60,
193-
interactiveRatio: 1 / window.devicePixelRatio,
194-
stillQuality: 100,
195-
stillRatio: 1,
196-
rpcMouseEvent: 'viewport.mouse.interaction',
197-
rpcGestureEvent: null,
198-
rpcWheelEvent: null,
199-
};
190+
function defaultValues(initialValues) {
191+
return {
192+
viewId: '-1',
193+
interactiveQuality: 60,
194+
interactiveRatio: 1 / window.devicePixelRatio,
195+
stillQuality: 100,
196+
stillRatio: 1,
197+
rpcMouseEvent: 'viewport.mouse.interaction',
198+
rpcGestureEvent: null,
199+
rpcWheelEvent: null,
200+
...initialValues,
201+
};
202+
}
200203

201204
// ----------------------------------------------------------------------------
202205

203206
export function extend(publicAPI, model, initialValues = {}) {
204-
Object.assign(model, DEFAULT_VALUES, initialValues);
207+
Object.assign(initialValues, defaultValues(initialValues));
205208

206209
macro.obj(publicAPI, model, initialValues);
207210
macro.get(publicAPI, model, [

0 commit comments

Comments
 (0)