@inweb/viewer-visualize 26.12.7 → 27.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,60 +0,0 @@
1
- ///////////////////////////////////////////////////////////////////////////////
2
- // Copyright (C) 2002-2025, Open Design Alliance (the "Alliance").
3
- // All rights reserved.
4
- //
5
- // This software and its documentation and related materials are owned by
6
- // the Alliance. The software may only be incorporated into application
7
- // programs owned by members of the Alliance, subject to a signed
8
- // Membership Agreement and Supplemental Software License Agreement with the
9
- // Alliance. The structure and organization of this software are the valuable
10
- // trade secrets of the Alliance and its suppliers. The software is also
11
- // protected by copyright law and international treaty provisions. Application
12
- // programs incorporating this software must include the following statement
13
- // with their copyright notices:
14
- //
15
- // This application incorporates Open Design Alliance software pursuant to a
16
- // license agreement with Open Design Alliance.
17
- // Open Design Alliance Copyright (C) 2002-2025 by Open Design Alliance.
18
- // All rights reserved.
19
- //
20
- // By use of this software, its documentation or related materials, you
21
- // acknowledge and accept the above terms.
22
- ///////////////////////////////////////////////////////////////////////////////
23
-
24
- import { Viewer } from "../Viewer";
25
-
26
- const DELAY_TIME_MULTIPLEXER = 2.0;
27
- const START_UPDATE_TIME = 1000;
28
-
29
- export enum UpdateType {
30
- kDelay,
31
- kNormal,
32
- kForce,
33
- }
34
-
35
- export class UpdateController {
36
- private lastUpdate: number;
37
- private viewer: Viewer;
38
- public delayUpdateTime: number;
39
-
40
- constructor() {
41
- this.lastUpdate = 0;
42
- this.delayUpdateTime = START_UPDATE_TIME;
43
- }
44
-
45
- initialize(viewer: Viewer) {
46
- this.viewer = viewer;
47
- this.lastUpdate = performance.now();
48
- }
49
-
50
- update(type: UpdateType) {
51
- const isNeedUpdate = type !== UpdateType.kDelay || performance.now() - this.lastUpdate >= this.delayUpdateTime;
52
- const isForce = type === UpdateType.kForce;
53
-
54
- if (isNeedUpdate) {
55
- this.viewer.update(isForce);
56
- this.lastUpdate = performance.now();
57
- this.delayUpdateTime *= DELAY_TIME_MULTIPLEXER;
58
- }
59
- }
60
- }