Skip to content

Commit

Permalink
refactor(remoteview): refactor constructor
Browse files Browse the repository at this point in the history
refactor constructor to call setters at instanciation
  • Loading branch information
joannacirillo committed Jun 15, 2022
1 parent 6e65814 commit 273158c
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions Sources/Rendering/Misc/RemoteView/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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, [
Expand Down

0 comments on commit 273158c

Please sign in to comment.