Autodesk.Viewing
Preferences
Application preferences.
Use Viewer3D#getPreferences to access the viewer’s preferences instance.
Methods
get(name)
Get named preference value.
Parameters
Returns
| type | description |
|---|---|
| boolean, number, string, null, undefined | Preference value, or undefined if the preference does not exist. |
set(name, value, notify)
Set named preference value.
Parameters
| name* string | Preference name, e.g. one of Prefs, Prefs2D or Prefs3D. |
| value* boolean, number, string, null | Preference value. |
| notify boolean | If true then Autodesk.Viewing.PREF_CHANGED_EVENT is fired and the listeners added via Preferences#addListeners are called. |
* Required
Returns
| type | description |
|---|---|
| boolean | True if the value changed, false otherwise. |
addListeners(name, onChangedCallback, onResetCallback)
Listen for preference changed and reset events. The callbacks receive the new preference value as their only argument.
Parameters
| name* string | Preference name. |
| onChangedCallback* function | Function called when the preference is changed. |
| onResetCallback function | Function called when the preference is reset. Defaults to onChangedCallback. |
* Required
removeListeners(name, onChangedCallback, onResetCallback)
Remove listeners for preference changed and reset events. Pass the same callbacks that were passed to Preferences#addListeners.
Parameters
| name* string | Preference name. |
| onChangedCallback* function | Function called when the preference is changed. |
| onResetCallback function | Function called when the preference is reset. Defaults to onChangedCallback. |
* Required