defaultViewer.d.ts 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. import { ViewerConfiguration, IModelConfiguration } from './../configuration/configuration';
  2. import { Template } from './../templateManager';
  3. import { AbstractViewer } from './viewer';
  4. import { ViewerModel } from '../model/viewerModel';
  5. /**
  6. * The Default viewer is the default implementation of the AbstractViewer.
  7. * It uses the templating system to render a new canvas and controls.
  8. */
  9. export declare class DefaultViewer extends AbstractViewer {
  10. containerElement: HTMLElement;
  11. /**
  12. * Create a new default viewer
  13. * @param containerElement the element in which the templates will be rendered
  14. * @param initialConfiguration the initial configuration. Defaults to extending the default configuration
  15. */
  16. constructor(containerElement: HTMLElement, initialConfiguration?: ViewerConfiguration);
  17. /**
  18. * This will be executed when the templates initialize.
  19. */
  20. protected _onTemplatesLoaded(): Promise<AbstractViewer>;
  21. private _dropped(evt);
  22. private _initNavbar();
  23. private _animationList;
  24. private _currentAnimation;
  25. private _isAnimationPaused;
  26. private _resumePlay;
  27. private _handlePointerDown;
  28. /**
  29. * Plays or Pauses animation
  30. */
  31. private _togglePlayPause;
  32. private _oldIdleRotationValue;
  33. /**
  34. * Control progress bar position based on animation current frame
  35. */
  36. private _updateProgressBar;
  37. /**
  38. * Update Current Animation Speed
  39. */
  40. private _updateAnimationSpeed;
  41. /**
  42. * Update Current Animation Type
  43. */
  44. private _updateAnimationType;
  45. /**
  46. * Toggle fullscreen of the entire viewer
  47. */
  48. toggleFullscreen: () => void;
  49. /**
  50. * Preparing the container element to present the viewer
  51. */
  52. protected _prepareContainerElement(): void;
  53. /**
  54. * This function will configure the templates and update them after a model was loaded
  55. * It is mainly responsible to changing the title and subtitle etc'.
  56. * @param model the model to be used to configure the templates by
  57. */
  58. protected _configureTemplate(model: ViewerModel): void;
  59. /**
  60. * This will load a new model to the default viewer
  61. * overriding the AbstractViewer's loadModel.
  62. * The scene will automatically be cleared of the old models, if exist.
  63. * @param model the configuration object (or URL) to load.
  64. */
  65. loadModel(model?: string | File | IModelConfiguration): Promise<ViewerModel>;
  66. private _onModelLoaded;
  67. /**
  68. * Show the overlay and the defined sub-screen.
  69. * Mainly used for help and errors
  70. * @param subScreen the name of the subScreen. Those can be defined in the configuration object
  71. */
  72. showOverlayScreen(subScreen: string): Promise<string> | Promise<Template>;
  73. /**
  74. * Hide the overlay screen.
  75. */
  76. hideOverlayScreen(): Promise<string> | Promise<Template>;
  77. /**
  78. * show the viewer (in case it was hidden)
  79. *
  80. * @param visibilityFunction an optional function to execute in order to show the container
  81. */
  82. show(visibilityFunction?: ((template: Template) => Promise<Template>)): Promise<Template>;
  83. /**
  84. * hide the viewer (in case it is visible)
  85. *
  86. * @param visibilityFunction an optional function to execute in order to hide the container
  87. */
  88. hide(visibilityFunction?: ((template: Template) => Promise<Template>)): Promise<Template>;
  89. /**
  90. * Show the loading screen.
  91. * The loading screen can be configured using the configuration object
  92. */
  93. showLoadingScreen(): Promise<string> | Promise<Template>;
  94. /**
  95. * Hide the loading screen
  96. */
  97. hideLoadingScreen(): Promise<string> | Promise<Template>;
  98. /**
  99. * An extension of the light configuration of the abstract viewer.
  100. * @param lightsConfiguration the light configuration to use
  101. * @param model the model that will be used to configure the lights (if the lights are model-dependant)
  102. */
  103. private _configureLights(lightsConfiguration?, model?);
  104. }