Class: GlobalView

PD. GlobalView


new GlobalView()

A central store of camera view and display data controlling the scene manager.

IMPORTANT: The properties in this class must be considered read-only. Mutations should only be done using methods within the PD.GlobalActions class or - if you absolutely must - applying changes only to the PD.GlobalViewProxy class which mirrors the data in this object.

As this code seeks to be framework-agnostic, it cannot use ready-made stores such as Vuex or Flux. However, it does need to appropriately support whatever framework and/or dynamic UI that is used to manage it.

Some of the properties in this store may be accessed thousands of times per frame during an interactive edit - such as the dynamic pointSizeModel and pointSizeView values and all the snap settings, so we really don't want these values to be reactive as that would add quantifiable and unnecessary overhead. Instead, front-end frameworks should create their own reactive proxy to this data by reassigning PD.GlobalStateProxy to keep these properties up-to-date with the UI. Any mutations to the data in this class should then be made only through either that proxy or by calling methods in the PD.GlobalActions class. Even then, any mutations made by PD.GlobalActions are applied to PD.GlobalViewProxy rather than this class directly.

This allows front-end frameworks such as Vue, React, Preact, Angular, Enyo, Ember, Knockout or any other to create observable getter/setters for entries in the store so that they can intercept state mutations and update the UI without adversely affecting or inadvertently modifying this class.

Also, in order to prevent unwanted 'leaking' of reactivity or observability into the actual BIM model, this class must remain a POJO (plain old JavaScript object) and contain only primitive values, arrays or simple objects - but never references to instances of framework classes. If it was to contain even a single reference to an instance of any of the model classes, there is a quantifiable risk that something like Vue.reactive() could inadvertently propagate throughout the model and make large parts of it reactive.

Author:
  • drajmarsh

Members


:PD.DISPLAY

modelViewPrevious <static>

Stores the previous display mode to compare changes with.

This value tracks the PD.GlobalView.modelView property and stores its last value after any changes.

Type