@itwin/imodel-components-react 5.19.0 → 5.20.0
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.
- package/CHANGELOG.md +7 -0
- package/lib/imodel-components-react/UiIModelComponents.js +1 -1
- package/lib/imodel-components-react/UiIModelComponents.js.map +1 -1
- package/lib/imodel-components-react/color/AlphaSlider.js +100 -100
- package/lib/imodel-components-react/color/AlphaSlider.js.map +1 -1
- package/lib/imodel-components-react/editors/ColorEditor.js +20 -23
- package/lib/imodel-components-react/editors/ColorEditor.js.map +1 -1
- package/lib/imodel-components-react/editors/WeightEditor.js +21 -21
- package/lib/imodel-components-react/editors/WeightEditor.js.map +1 -1
- package/lib/imodel-components-react/lineweight/WeightPickerButton.js +53 -53
- package/lib/imodel-components-react/lineweight/WeightPickerButton.js.map +1 -1
- package/lib/imodel-components-react/navigationaids/Cube.js +1 -4
- package/lib/imodel-components-react/navigationaids/Cube.js.map +1 -1
- package/lib/imodel-components-react/navigationaids/CubeNavigationAid.js +296 -302
- package/lib/imodel-components-react/navigationaids/CubeNavigationAid.js.map +1 -1
- package/lib/imodel-components-react/navigationaids/DrawingNavigationAid.js +428 -425
- package/lib/imodel-components-react/navigationaids/DrawingNavigationAid.js.map +1 -1
- package/lib/imodel-components-react/timeline/BaseSolarDataProvider.js +20 -17
- package/lib/imodel-components-react/timeline/BaseSolarDataProvider.js.map +1 -1
- package/lib/imodel-components-react/timeline/BaseTimelineDataProvider.js +13 -10
- package/lib/imodel-components-react/timeline/BaseTimelineDataProvider.js.map +1 -1
- package/lib/imodel-components-react/timeline/InlineEdit.js +20 -20
- package/lib/imodel-components-react/timeline/InlineEdit.js.map +1 -1
- package/lib/imodel-components-react/timeline/SolarTimeline.js +144 -144
- package/lib/imodel-components-react/timeline/SolarTimeline.js.map +1 -1
- package/lib/imodel-components-react/viewport/ViewportComponentEvents.js +16 -15
- package/lib/imodel-components-react/viewport/ViewportComponentEvents.js.map +1 -1
- package/package.json +7 -7
|
@@ -39,152 +39,23 @@ function Timeline(props) {
|
|
|
39
39
|
* @alpha
|
|
40
40
|
*/
|
|
41
41
|
export class SolarTimeline extends React.PureComponent {
|
|
42
|
+
_requestFrame = 0;
|
|
43
|
+
_unmounted = false;
|
|
44
|
+
_timeLastCycle = 0;
|
|
45
|
+
_totalPlayTime = 0;
|
|
46
|
+
_presetColors = [
|
|
47
|
+
ColorDef.create(ColorByName.grey),
|
|
48
|
+
ColorDef.create(ColorByName.lightGrey),
|
|
49
|
+
ColorDef.create(ColorByName.darkGrey),
|
|
50
|
+
ColorDef.create(ColorByName.lightBlue),
|
|
51
|
+
ColorDef.create(ColorByName.lightGreen),
|
|
52
|
+
ColorDef.create(ColorByName.darkGreen),
|
|
53
|
+
ColorDef.create(ColorByName.tan),
|
|
54
|
+
ColorDef.create(ColorByName.darkBrown),
|
|
55
|
+
];
|
|
56
|
+
_speeds = [1, 2, 3, 4, 5, 6];
|
|
42
57
|
constructor(props) {
|
|
43
58
|
super(props);
|
|
44
|
-
this._requestFrame = 0;
|
|
45
|
-
this._unmounted = false;
|
|
46
|
-
this._timeLastCycle = 0;
|
|
47
|
-
this._totalPlayTime = 0;
|
|
48
|
-
this._presetColors = [
|
|
49
|
-
ColorDef.create(ColorByName.grey),
|
|
50
|
-
ColorDef.create(ColorByName.lightGrey),
|
|
51
|
-
ColorDef.create(ColorByName.darkGrey),
|
|
52
|
-
ColorDef.create(ColorByName.lightBlue),
|
|
53
|
-
ColorDef.create(ColorByName.lightGreen),
|
|
54
|
-
ColorDef.create(ColorByName.darkGreen),
|
|
55
|
-
ColorDef.create(ColorByName.tan),
|
|
56
|
-
ColorDef.create(ColorByName.darkBrown),
|
|
57
|
-
];
|
|
58
|
-
this._speeds = [1, 2, 3, 4, 5, 6];
|
|
59
|
-
// recursively update the animation until we hit the end or the pause button is clicked
|
|
60
|
-
this._updateAnimation = (_timestamp) => {
|
|
61
|
-
if (!this.state.isPlaying || this._unmounted) {
|
|
62
|
-
window.cancelAnimationFrame(this._requestFrame);
|
|
63
|
-
return;
|
|
64
|
-
}
|
|
65
|
-
const currentTime = new Date().getTime();
|
|
66
|
-
this._totalPlayTime += currentTime - this._timeLastCycle;
|
|
67
|
-
this._timeLastCycle = currentTime;
|
|
68
|
-
let percentComplete = this._totalPlayTime / this.state.adjustedDuration;
|
|
69
|
-
if (percentComplete > 1)
|
|
70
|
-
percentComplete = 1;
|
|
71
|
-
let newPlayingState = true;
|
|
72
|
-
// calculate the next sun time base on the percentage playback complete - should be int value as that is step amount for slider
|
|
73
|
-
let nextSunOffset = Math.floor(this.state.sunRiseOffsetMs + percentComplete * this.state.sunDeltaMs);
|
|
74
|
-
if (percentComplete > 0.99) {
|
|
75
|
-
if (!this.state.loop) {
|
|
76
|
-
newPlayingState = false;
|
|
77
|
-
nextSunOffset = this.state.sunSetOffsetMs;
|
|
78
|
-
window.cancelAnimationFrame(this._requestFrame);
|
|
79
|
-
}
|
|
80
|
-
else {
|
|
81
|
-
nextSunOffset = this.state.sunRiseOffsetMs;
|
|
82
|
-
this._totalPlayTime = 0;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
if (this.props.dataProvider.onTimeChanged) {
|
|
86
|
-
const currentSunTime = new Date(this.state.dayStartMs + nextSunOffset);
|
|
87
|
-
this.props.dataProvider.onTimeChanged(currentSunTime);
|
|
88
|
-
}
|
|
89
|
-
this.setState({ isPlaying: newPlayingState, currentTimeOffsetMs: nextSunOffset }, () => {
|
|
90
|
-
if (newPlayingState)
|
|
91
|
-
this._requestFrame = window.requestAnimationFrame(this._updateAnimation);
|
|
92
|
-
});
|
|
93
|
-
};
|
|
94
|
-
// user clicked pause button
|
|
95
|
-
this._onPause = () => {
|
|
96
|
-
if (!this.state.isPlaying)
|
|
97
|
-
return;
|
|
98
|
-
const currentTime = new Date().getTime();
|
|
99
|
-
this._totalPlayTime += currentTime - this._timeLastCycle;
|
|
100
|
-
// stop requesting frames
|
|
101
|
-
window.cancelAnimationFrame(this._requestFrame);
|
|
102
|
-
// stop playing
|
|
103
|
-
this.setState({ isPlaying: false });
|
|
104
|
-
if (this.props.onPlayPause)
|
|
105
|
-
this.props.onPlayPause(false);
|
|
106
|
-
};
|
|
107
|
-
// user clicked play button
|
|
108
|
-
this._onPlay = () => {
|
|
109
|
-
if (this.state.isPlaying)
|
|
110
|
-
return;
|
|
111
|
-
if (this.state.currentTimeOffsetMs >= this.state.sunSetOffsetMs ||
|
|
112
|
-
this.state.currentTimeOffsetMs <= this.state.sunRiseOffsetMs) {
|
|
113
|
-
this._totalPlayTime = 0;
|
|
114
|
-
this._play(this.state.sunRiseOffsetMs);
|
|
115
|
-
}
|
|
116
|
-
else {
|
|
117
|
-
this._play(this.state.currentTimeOffsetMs);
|
|
118
|
-
}
|
|
119
|
-
};
|
|
120
|
-
this._onDateChange = (newDate) => {
|
|
121
|
-
this.props.dataProvider.setDateAndTime(newDate);
|
|
122
|
-
const dayStartMs = this.props.dataProvider.dayStartMs;
|
|
123
|
-
const sunRiseOffsetMs = this.props.dataProvider.sunrise.getTime() - dayStartMs;
|
|
124
|
-
const sunSetOffsetMs = this.props.dataProvider.sunset.getTime() - dayStartMs;
|
|
125
|
-
const sunDeltaMs = sunSetOffsetMs - sunRiseOffsetMs;
|
|
126
|
-
/** call dataProvider to update display style */
|
|
127
|
-
// this.props.dataProvider.onTimeChanged?.(this.props.dataProvider.timeOfDay);
|
|
128
|
-
// Update time
|
|
129
|
-
const newHours = newDate.getHours();
|
|
130
|
-
const newMinutes = newDate.getMinutes();
|
|
131
|
-
const newSunTime = newHours * msPerHour + newMinutes * msPerMinute;
|
|
132
|
-
const dateWithNewTime = new Date(dayStartMs + newSunTime);
|
|
133
|
-
// this.props.dataProvider.setDateAndTime(dateWithNewTime, true);
|
|
134
|
-
const currentTimeOffsetMs = this.ensureRange(newSunTime, sunRiseOffsetMs, sunSetOffsetMs);
|
|
135
|
-
this.setPlaybackTimeBySunTime(currentTimeOffsetMs, sunRiseOffsetMs, sunDeltaMs);
|
|
136
|
-
this._timeLastCycle = new Date().getTime();
|
|
137
|
-
this.props.dataProvider.onTimeChanged?.(dateWithNewTime);
|
|
138
|
-
this.setState({
|
|
139
|
-
dayStartMs,
|
|
140
|
-
sunRiseOffsetMs,
|
|
141
|
-
sunSetOffsetMs,
|
|
142
|
-
currentTimeOffsetMs,
|
|
143
|
-
sunDeltaMs,
|
|
144
|
-
isDateOpened: false,
|
|
145
|
-
});
|
|
146
|
-
};
|
|
147
|
-
this._onCloseSettingsPopup = () => {
|
|
148
|
-
this.setState({ isSettingsOpened: false });
|
|
149
|
-
};
|
|
150
|
-
this._onOpenSettingsPopup = () => {
|
|
151
|
-
this.setState((prevState) => ({
|
|
152
|
-
isSettingsOpened: !prevState.isSettingsOpened,
|
|
153
|
-
}));
|
|
154
|
-
};
|
|
155
|
-
this._onUpdate = (values) => {
|
|
156
|
-
if (!this.state.isPlaying)
|
|
157
|
-
this.processSunTimeChange(values[0]);
|
|
158
|
-
};
|
|
159
|
-
this._onChange = (values) => {
|
|
160
|
-
if (!this.state.isPlaying)
|
|
161
|
-
this.processSunTimeChange(values[0]);
|
|
162
|
-
};
|
|
163
|
-
this._onSpeedChange = (value) => {
|
|
164
|
-
const adjustedDuration = this.state.duration / value;
|
|
165
|
-
this.setState({ speed: value, adjustedDuration });
|
|
166
|
-
};
|
|
167
|
-
this._onToggleLoop = () => {
|
|
168
|
-
this.setState((prevState) => ({ loop: !prevState.loop }));
|
|
169
|
-
};
|
|
170
|
-
this._formatTime = (ms) => {
|
|
171
|
-
const date = new Date(ms);
|
|
172
|
-
const amLabel = UiComponents.translate("time.am");
|
|
173
|
-
const pmLabel = UiComponents.translate("time.pm");
|
|
174
|
-
// convert project date to browser locale date
|
|
175
|
-
const localTime = adjustDateToTimezone(date, this.props.dataProvider.timeZoneOffset * 60);
|
|
176
|
-
let hours = localTime.getHours();
|
|
177
|
-
const minutes = date.getMinutes();
|
|
178
|
-
const abbrev = hours < 12 ? amLabel : hours === 24 ? amLabel : pmLabel;
|
|
179
|
-
hours = hours > 12 ? hours - 12 : hours;
|
|
180
|
-
const hoursStr = hours.toLocaleString(undefined, {
|
|
181
|
-
minimumIntegerDigits: 2,
|
|
182
|
-
});
|
|
183
|
-
const minutesStr = minutes.toLocaleString(undefined, {
|
|
184
|
-
minimumIntegerDigits: 2,
|
|
185
|
-
});
|
|
186
|
-
return `${hoursStr}:${minutesStr} ${abbrev}`;
|
|
187
|
-
};
|
|
188
59
|
const dayStartMs = this.props.dataProvider.dayStartMs;
|
|
189
60
|
const sunRiseOffsetMs = this.props.dataProvider.sunrise.getTime() - dayStartMs;
|
|
190
61
|
const sunSetOffsetMs = this.props.dataProvider.sunset.getTime() - dayStartMs;
|
|
@@ -218,6 +89,41 @@ export class SolarTimeline extends React.PureComponent {
|
|
|
218
89
|
window.cancelAnimationFrame(this._requestFrame);
|
|
219
90
|
this._unmounted = true;
|
|
220
91
|
}
|
|
92
|
+
// recursively update the animation until we hit the end or the pause button is clicked
|
|
93
|
+
_updateAnimation = (_timestamp) => {
|
|
94
|
+
if (!this.state.isPlaying || this._unmounted) {
|
|
95
|
+
window.cancelAnimationFrame(this._requestFrame);
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
const currentTime = new Date().getTime();
|
|
99
|
+
this._totalPlayTime += currentTime - this._timeLastCycle;
|
|
100
|
+
this._timeLastCycle = currentTime;
|
|
101
|
+
let percentComplete = this._totalPlayTime / this.state.adjustedDuration;
|
|
102
|
+
if (percentComplete > 1)
|
|
103
|
+
percentComplete = 1;
|
|
104
|
+
let newPlayingState = true;
|
|
105
|
+
// calculate the next sun time base on the percentage playback complete - should be int value as that is step amount for slider
|
|
106
|
+
let nextSunOffset = Math.floor(this.state.sunRiseOffsetMs + percentComplete * this.state.sunDeltaMs);
|
|
107
|
+
if (percentComplete > 0.99) {
|
|
108
|
+
if (!this.state.loop) {
|
|
109
|
+
newPlayingState = false;
|
|
110
|
+
nextSunOffset = this.state.sunSetOffsetMs;
|
|
111
|
+
window.cancelAnimationFrame(this._requestFrame);
|
|
112
|
+
}
|
|
113
|
+
else {
|
|
114
|
+
nextSunOffset = this.state.sunRiseOffsetMs;
|
|
115
|
+
this._totalPlayTime = 0;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
if (this.props.dataProvider.onTimeChanged) {
|
|
119
|
+
const currentSunTime = new Date(this.state.dayStartMs + nextSunOffset);
|
|
120
|
+
this.props.dataProvider.onTimeChanged(currentSunTime);
|
|
121
|
+
}
|
|
122
|
+
this.setState({ isPlaying: newPlayingState, currentTimeOffsetMs: nextSunOffset }, () => {
|
|
123
|
+
if (newPlayingState)
|
|
124
|
+
this._requestFrame = window.requestAnimationFrame(this._updateAnimation);
|
|
125
|
+
});
|
|
126
|
+
};
|
|
221
127
|
_play(sunTimeMs) {
|
|
222
128
|
this._timeLastCycle = new Date().getTime();
|
|
223
129
|
// start playing
|
|
@@ -227,11 +133,72 @@ export class SolarTimeline extends React.PureComponent {
|
|
|
227
133
|
this.props.onPlayPause(true);
|
|
228
134
|
});
|
|
229
135
|
}
|
|
136
|
+
// user clicked pause button
|
|
137
|
+
_onPause = () => {
|
|
138
|
+
if (!this.state.isPlaying)
|
|
139
|
+
return;
|
|
140
|
+
const currentTime = new Date().getTime();
|
|
141
|
+
this._totalPlayTime += currentTime - this._timeLastCycle;
|
|
142
|
+
// stop requesting frames
|
|
143
|
+
window.cancelAnimationFrame(this._requestFrame);
|
|
144
|
+
// stop playing
|
|
145
|
+
this.setState({ isPlaying: false });
|
|
146
|
+
if (this.props.onPlayPause)
|
|
147
|
+
this.props.onPlayPause(false);
|
|
148
|
+
};
|
|
149
|
+
// user clicked play button
|
|
150
|
+
_onPlay = () => {
|
|
151
|
+
if (this.state.isPlaying)
|
|
152
|
+
return;
|
|
153
|
+
if (this.state.currentTimeOffsetMs >= this.state.sunSetOffsetMs ||
|
|
154
|
+
this.state.currentTimeOffsetMs <= this.state.sunRiseOffsetMs) {
|
|
155
|
+
this._totalPlayTime = 0;
|
|
156
|
+
this._play(this.state.sunRiseOffsetMs);
|
|
157
|
+
}
|
|
158
|
+
else {
|
|
159
|
+
this._play(this.state.currentTimeOffsetMs);
|
|
160
|
+
}
|
|
161
|
+
};
|
|
230
162
|
setPlaybackTimeBySunTime(sunOffsetMs, sunRiseOffsetMs, sunDeltaMs, adjustedDuration) {
|
|
231
163
|
this._totalPlayTime =
|
|
232
164
|
((sunOffsetMs - sunRiseOffsetMs) / sunDeltaMs) *
|
|
233
165
|
(adjustedDuration ? adjustedDuration : this.state.adjustedDuration);
|
|
234
166
|
}
|
|
167
|
+
_onDateChange = (newDate) => {
|
|
168
|
+
this.props.dataProvider.setDateAndTime(newDate);
|
|
169
|
+
const dayStartMs = this.props.dataProvider.dayStartMs;
|
|
170
|
+
const sunRiseOffsetMs = this.props.dataProvider.sunrise.getTime() - dayStartMs;
|
|
171
|
+
const sunSetOffsetMs = this.props.dataProvider.sunset.getTime() - dayStartMs;
|
|
172
|
+
const sunDeltaMs = sunSetOffsetMs - sunRiseOffsetMs;
|
|
173
|
+
/** call dataProvider to update display style */
|
|
174
|
+
// this.props.dataProvider.onTimeChanged?.(this.props.dataProvider.timeOfDay);
|
|
175
|
+
// Update time
|
|
176
|
+
const newHours = newDate.getHours();
|
|
177
|
+
const newMinutes = newDate.getMinutes();
|
|
178
|
+
const newSunTime = newHours * msPerHour + newMinutes * msPerMinute;
|
|
179
|
+
const dateWithNewTime = new Date(dayStartMs + newSunTime);
|
|
180
|
+
// this.props.dataProvider.setDateAndTime(dateWithNewTime, true);
|
|
181
|
+
const currentTimeOffsetMs = this.ensureRange(newSunTime, sunRiseOffsetMs, sunSetOffsetMs);
|
|
182
|
+
this.setPlaybackTimeBySunTime(currentTimeOffsetMs, sunRiseOffsetMs, sunDeltaMs);
|
|
183
|
+
this._timeLastCycle = new Date().getTime();
|
|
184
|
+
this.props.dataProvider.onTimeChanged?.(dateWithNewTime);
|
|
185
|
+
this.setState({
|
|
186
|
+
dayStartMs,
|
|
187
|
+
sunRiseOffsetMs,
|
|
188
|
+
sunSetOffsetMs,
|
|
189
|
+
currentTimeOffsetMs,
|
|
190
|
+
sunDeltaMs,
|
|
191
|
+
isDateOpened: false,
|
|
192
|
+
});
|
|
193
|
+
};
|
|
194
|
+
_onCloseSettingsPopup = () => {
|
|
195
|
+
this.setState({ isSettingsOpened: false });
|
|
196
|
+
};
|
|
197
|
+
_onOpenSettingsPopup = () => {
|
|
198
|
+
this.setState((prevState) => ({
|
|
199
|
+
isSettingsOpened: !prevState.isSettingsOpened,
|
|
200
|
+
}));
|
|
201
|
+
};
|
|
235
202
|
ensureRange(value, min, max) {
|
|
236
203
|
return Math.max(Math.min(value, max), min);
|
|
237
204
|
}
|
|
@@ -251,6 +218,39 @@ export class SolarTimeline extends React.PureComponent {
|
|
|
251
218
|
this._totalPlayTime = percentComplete * this.state.adjustedDuration;
|
|
252
219
|
});
|
|
253
220
|
}
|
|
221
|
+
_onUpdate = (values) => {
|
|
222
|
+
if (!this.state.isPlaying)
|
|
223
|
+
this.processSunTimeChange(values[0]);
|
|
224
|
+
};
|
|
225
|
+
_onChange = (values) => {
|
|
226
|
+
if (!this.state.isPlaying)
|
|
227
|
+
this.processSunTimeChange(values[0]);
|
|
228
|
+
};
|
|
229
|
+
_onSpeedChange = (value) => {
|
|
230
|
+
const adjustedDuration = this.state.duration / value;
|
|
231
|
+
this.setState({ speed: value, adjustedDuration });
|
|
232
|
+
};
|
|
233
|
+
_onToggleLoop = () => {
|
|
234
|
+
this.setState((prevState) => ({ loop: !prevState.loop }));
|
|
235
|
+
};
|
|
236
|
+
_formatTime = (ms) => {
|
|
237
|
+
const date = new Date(ms);
|
|
238
|
+
const amLabel = UiComponents.translate("time.am");
|
|
239
|
+
const pmLabel = UiComponents.translate("time.pm");
|
|
240
|
+
// convert project date to browser locale date
|
|
241
|
+
const localTime = adjustDateToTimezone(date, this.props.dataProvider.timeZoneOffset * 60);
|
|
242
|
+
let hours = localTime.getHours();
|
|
243
|
+
const minutes = date.getMinutes();
|
|
244
|
+
const abbrev = hours < 12 ? amLabel : hours === 24 ? amLabel : pmLabel;
|
|
245
|
+
hours = hours > 12 ? hours - 12 : hours;
|
|
246
|
+
const hoursStr = hours.toLocaleString(undefined, {
|
|
247
|
+
minimumIntegerDigits: 2,
|
|
248
|
+
});
|
|
249
|
+
const minutesStr = minutes.toLocaleString(undefined, {
|
|
250
|
+
minimumIntegerDigits: 2,
|
|
251
|
+
});
|
|
252
|
+
return `${hoursStr}:${minutesStr} ${abbrev}`;
|
|
253
|
+
};
|
|
254
254
|
getLocalTime(ticks) {
|
|
255
255
|
const projectTime = new Date(ticks);
|
|
256
256
|
// convert project date to browser locale date
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SolarTimeline.js","sourceRoot":"","sources":["../../../src/imodel-components-react/timeline/SolarTimeline.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,sBAAsB,CAAC;AAC9B,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAE3D,OAAO,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAC7E,OAAO,EACL,MAAM,EACN,YAAY,EACZ,eAAe,EACf,YAAY,EACZ,WAAW,EACX,UAAU,EACV,IAAI,EACJ,IAAI,EACJ,UAAU,EACV,KAAK,EACL,OAAO,EACP,MAAM,EACN,MAAM,EACN,IAAI,EACJ,OAAO,EACP,cAAc,GACf,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,WAAW,EACX,OAAO,EACP,OAAO,EACP,WAAW,EACX,MAAM,GACP,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB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AM,cAAc,GAAG,KAAK,CAAC,UAAU,CACrC,SAAS,cAAc,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,GAAG;IAChD,MAAM,EAAE,SAAS,EAAE,GAAG,cAAc,EAAE,CAAC;IACvC,MAAM,OAAO,GAAG,SAAS,CAAC,wBAAwB,CAAC,CAAC;IAEpD,OAAO,CACL,oBAAC,OAAO,IAAC,OAAO,EAAE,OAAO;QACvB,oBAAC,MAAM,IACL,SAAS,EAAC,YAAY,EACtB,SAAS,EAAE,oBAAC,WAAW,OAAG,iBACd,wBAAwB,EACpC,KAAK,EAAE,OAAO,EACd,OAAO,EAAE,OAAO,EAChB,GAAG,EAAE,GAAG;YAER,8BAAM,SAAS,EAAC,0BAA0B,IAAE,QAAQ,CAAQ,CACrD,CACD,CACX,CAAC;AACJ,CAAC,CACF,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Timeline\n */\n\nimport \"./SolarTimeline.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport { ColorByName, ColorDef } from \"@itwin/core-common\";\nimport type { CommonProps } from \"@itwin/core-react\";\nimport { adjustDateToTimezone, UiComponents } from \"@itwin/components-react\";\nimport {\n Button,\n ColorBuilder,\n ColorInputPanel,\n ColorPalette,\n ColorPicker,\n DatePicker,\n Flex,\n Icon,\n IconButton,\n Label,\n Popover,\n Select,\n Slider,\n Text,\n Tooltip,\n VisuallyHidden,\n} from \"@itwin/itwinui-react\";\nimport {\n SvgCalendar,\n SvgLoop,\n SvgMoon,\n SvgSettings,\n SvgSun,\n} from \"@itwin/itwinui-icons-react\";\nimport type { SolarDataProvider } from \"./interfaces.js\";\nimport { UiIModelComponents } from \"../UiIModelComponents.js\";\nimport { PlayButton } from \"./PlayButton.js\";\nimport { useTranslation } from \"../useTranslation.js\";\n\nconst msPerMinute = 1000 * 60;\nconst msPerHour = msPerMinute * 60;\nconst defaultPlaybackDuration = 40 * 1000;\n\nconst offset = 6;\n\n// eslint-disable-next-line @typescript-eslint/no-deprecated\ninterface TimelineProps extends CommonProps {\n dayStartMs: number;\n sunRiseOffsetMs: number;\n sunSetOffsetMs: number;\n currentTimeOffsetMs: number;\n isPlaying: boolean;\n formatTick?: (ms: number) => string;\n formatTime: (ms: number) => string;\n onChange?: (values: ReadonlyArray<number>) => void;\n onUpdate?: (values: ReadonlyArray<number>) => void;\n}\n\nfunction Timeline(props: TimelineProps) {\n const {\n formatTick,\n formatTime,\n onChange,\n onUpdate,\n dayStartMs,\n sunSetOffsetMs,\n sunRiseOffsetMs,\n currentTimeOffsetMs,\n } = props;\n\n const tooltipContent = formatTime(dayStartMs + currentTimeOffsetMs);\n\n const className = classnames(\n \"solar-timeline\",\n props.className,\n formatTick && \"showticks\"\n );\n const sunRiseStr = formatTime(dayStartMs + sunRiseOffsetMs);\n const sunSetStr = formatTime(dayStartMs + sunSetOffsetMs);\n return (\n <div className={className}>\n <VisuallyHidden>Solar timeline</VisuallyHidden>\n <Slider\n thumbProps={() => ({ \"aria-labelledby\": \"timeline\" })}\n step={msPerMinute}\n min={sunRiseOffsetMs}\n max={sunSetOffsetMs}\n minLabel={\n <Tooltip content={sunRiseStr}>\n <Icon>\n <SvgSun />\n </Icon>\n </Tooltip>\n }\n maxLabel={\n <Tooltip content={sunSetStr}>\n <Icon>\n <SvgMoon />\n </Icon>\n </Tooltip>\n }\n onUpdate={onUpdate}\n onChange={onChange}\n values={[currentTimeOffsetMs]}\n tooltipProps={() => ({\n content: tooltipContent,\n })}\n />\n </div>\n );\n}\n\ninterface SolarTimelineComponentProps {\n dataProvider: SolarDataProvider; // provides date, sunrise, sunset in ms, also contains timezone offset from UTC, and updates the display style to current time.\n onPlayPause?: (playing: boolean) => void; // callback triggered when play/pause button is pressed\n duration?: number; // playback duration in milliseconds\n speed?: number;\n}\n\ninterface SolarTimelineComponentState {\n isPlaying: boolean; // timeline is currently playing or paused\n isDateOpened: boolean; // date picker is opened\n isSettingsOpened: boolean; // settings popup is opened\n dayStartMs: number;\n sunRiseOffsetMs: number;\n sunSetOffsetMs: number;\n sunDeltaMs: number;\n currentTimeOffsetMs: number;\n speed: number;\n loop: boolean;\n shadowColor: ColorDef;\n duration: number; // playback duration in milliseconds\n adjustedDuration: number; // playback duration in milliseconds/ speed\n}\n\n/** Solar Timeline\n * @alpha\n */\nexport class SolarTimeline extends React.PureComponent<\n SolarTimelineComponentProps,\n SolarTimelineComponentState\n> {\n private _requestFrame = 0;\n private _unmounted = false;\n private _timeLastCycle = 0;\n private _totalPlayTime = 0;\n\n private readonly _presetColors = [\n ColorDef.create(ColorByName.grey),\n ColorDef.create(ColorByName.lightGrey),\n ColorDef.create(ColorByName.darkGrey),\n ColorDef.create(ColorByName.lightBlue),\n ColorDef.create(ColorByName.lightGreen),\n ColorDef.create(ColorByName.darkGreen),\n ColorDef.create(ColorByName.tan),\n ColorDef.create(ColorByName.darkBrown),\n ];\n\n private readonly _speeds = [1, 2, 3, 4, 5, 6];\n\n constructor(props: SolarTimelineComponentProps) {\n super(props);\n\n const dayStartMs = this.props.dataProvider.dayStartMs;\n const sunRiseOffsetMs =\n this.props.dataProvider.sunrise.getTime() - dayStartMs;\n const sunSetOffsetMs =\n this.props.dataProvider.sunset.getTime() - dayStartMs;\n const sunDeltaMs = sunSetOffsetMs - sunRiseOffsetMs;\n const sunOffsetMs =\n this.props.dataProvider.timeOfDay.getTime() - dayStartMs;\n const currentTimeOffsetMs = this.ensureRange(\n sunOffsetMs,\n sunRiseOffsetMs,\n sunSetOffsetMs\n );\n const shadowColor = this.props.dataProvider.shadowColor;\n const duration = this.props.duration\n ? this.props.duration\n : defaultPlaybackDuration;\n const speed = this.props.speed ? this.props.speed : 2;\n const adjustedDuration = duration / speed;\n this.setPlaybackTimeBySunTime(\n currentTimeOffsetMs,\n sunRiseOffsetMs,\n sunDeltaMs,\n adjustedDuration\n );\n\n this.state = {\n isDateOpened: false,\n isSettingsOpened: false,\n isPlaying: false,\n dayStartMs,\n sunRiseOffsetMs,\n sunSetOffsetMs,\n sunDeltaMs,\n currentTimeOffsetMs,\n speed,\n loop: false,\n shadowColor,\n duration,\n adjustedDuration,\n };\n }\n\n public override componentWillUnmount() {\n window.cancelAnimationFrame(this._requestFrame);\n this._unmounted = true;\n }\n\n // recursively update the animation until we hit the end or the pause button is clicked\n private _updateAnimation = (_timestamp: number) => {\n if (!this.state.isPlaying || this._unmounted) {\n window.cancelAnimationFrame(this._requestFrame);\n return;\n }\n\n const currentTime = new Date().getTime();\n this._totalPlayTime += currentTime - this._timeLastCycle;\n this._timeLastCycle = currentTime;\n let percentComplete = this._totalPlayTime / this.state.adjustedDuration;\n if (percentComplete > 1) percentComplete = 1;\n\n let newPlayingState = true;\n\n // calculate the next sun time base on the percentage playback complete - should be int value as that is step amount for slider\n let nextSunOffset = Math.floor(\n this.state.sunRiseOffsetMs + percentComplete * this.state.sunDeltaMs\n );\n\n if (percentComplete > 0.99) {\n if (!this.state.loop) {\n newPlayingState = false;\n nextSunOffset = this.state.sunSetOffsetMs;\n window.cancelAnimationFrame(this._requestFrame);\n } else {\n nextSunOffset = this.state.sunRiseOffsetMs;\n this._totalPlayTime = 0;\n }\n }\n\n if (this.props.dataProvider.onTimeChanged) {\n const currentSunTime = new Date(this.state.dayStartMs + nextSunOffset);\n this.props.dataProvider.onTimeChanged(currentSunTime);\n }\n\n this.setState(\n { isPlaying: newPlayingState, currentTimeOffsetMs: nextSunOffset },\n () => {\n if (newPlayingState)\n this._requestFrame = window.requestAnimationFrame(\n this._updateAnimation\n );\n }\n );\n };\n\n private _play(sunTimeMs: number) {\n this._timeLastCycle = new Date().getTime();\n\n // start playing\n this.setState({ isPlaying: true, currentTimeOffsetMs: sunTimeMs }, () => {\n this._requestFrame = window.requestAnimationFrame(this._updateAnimation);\n if (this.props.onPlayPause) this.props.onPlayPause(true);\n });\n }\n\n // user clicked pause button\n private _onPause = () => {\n if (!this.state.isPlaying) return;\n\n const currentTime = new Date().getTime();\n this._totalPlayTime += currentTime - this._timeLastCycle;\n\n // stop requesting frames\n window.cancelAnimationFrame(this._requestFrame);\n\n // stop playing\n this.setState({ isPlaying: false });\n\n if (this.props.onPlayPause) this.props.onPlayPause(false);\n };\n\n // user clicked play button\n private _onPlay = () => {\n if (this.state.isPlaying) return;\n\n if (\n this.state.currentTimeOffsetMs >= this.state.sunSetOffsetMs ||\n this.state.currentTimeOffsetMs <= this.state.sunRiseOffsetMs\n ) {\n this._totalPlayTime = 0;\n this._play(this.state.sunRiseOffsetMs);\n } else {\n this._play(this.state.currentTimeOffsetMs);\n }\n };\n\n private setPlaybackTimeBySunTime(\n sunOffsetMs: number,\n sunRiseOffsetMs: number,\n sunDeltaMs: number,\n adjustedDuration?: number\n ) {\n this._totalPlayTime =\n ((sunOffsetMs - sunRiseOffsetMs) / sunDeltaMs) *\n (adjustedDuration ? adjustedDuration : this.state.adjustedDuration);\n }\n\n private _onDateChange = (newDate: Date) => {\n this.props.dataProvider.setDateAndTime(newDate);\n\n const dayStartMs = this.props.dataProvider.dayStartMs;\n const sunRiseOffsetMs =\n this.props.dataProvider.sunrise.getTime() - dayStartMs;\n const sunSetOffsetMs =\n this.props.dataProvider.sunset.getTime() - dayStartMs;\n const sunDeltaMs = sunSetOffsetMs - sunRiseOffsetMs;\n\n /** call dataProvider to update display style */\n // this.props.dataProvider.onTimeChanged?.(this.props.dataProvider.timeOfDay);\n\n // Update time\n const newHours = newDate.getHours();\n const newMinutes = newDate.getMinutes();\n const newSunTime = newHours * msPerHour + newMinutes * msPerMinute;\n const dateWithNewTime = new Date(dayStartMs + newSunTime);\n // this.props.dataProvider.setDateAndTime(dateWithNewTime, true);\n\n const currentTimeOffsetMs = this.ensureRange(\n newSunTime,\n sunRiseOffsetMs,\n sunSetOffsetMs\n );\n this.setPlaybackTimeBySunTime(\n currentTimeOffsetMs,\n sunRiseOffsetMs,\n sunDeltaMs\n );\n this._timeLastCycle = new Date().getTime();\n\n this.props.dataProvider.onTimeChanged?.(dateWithNewTime);\n this.setState({\n dayStartMs,\n sunRiseOffsetMs,\n sunSetOffsetMs,\n currentTimeOffsetMs,\n sunDeltaMs,\n isDateOpened: false,\n });\n };\n\n private _onCloseSettingsPopup = () => {\n this.setState({ isSettingsOpened: false });\n };\n\n private _onOpenSettingsPopup = () => {\n this.setState((prevState) => ({\n isSettingsOpened: !prevState.isSettingsOpened,\n }));\n };\n\n private ensureRange(value: number, min: number, max: number): number {\n return Math.max(Math.min(value, max), min);\n }\n\n private processSunTimeChange(sunTime: number) {\n if (sunTime === this.state.currentTimeOffsetMs) return;\n\n const currentTimeOffsetMs = this.ensureRange(\n sunTime,\n this.state.sunRiseOffsetMs,\n this.state.sunSetOffsetMs\n );\n\n if (this.props.dataProvider.onTimeChanged) {\n const currentSunTime = new Date(\n this.state.dayStartMs + currentTimeOffsetMs\n );\n this.props.dataProvider.onTimeChanged(currentSunTime);\n }\n\n this.setState({ currentTimeOffsetMs }, () => {\n const currentTime = new Date().getTime();\n this._timeLastCycle = currentTime;\n const percentComplete =\n (currentTimeOffsetMs - this.state.sunRiseOffsetMs) /\n this.state.sunDeltaMs;\n this._totalPlayTime = percentComplete * this.state.adjustedDuration;\n });\n }\n\n private _onUpdate = (values: ReadonlyArray<number>) => {\n if (!this.state.isPlaying) this.processSunTimeChange(values[0]);\n };\n\n private _onChange = (values: ReadonlyArray<number>) => {\n if (!this.state.isPlaying) this.processSunTimeChange(values[0]);\n };\n\n private _onSpeedChange = (value: number) => {\n const adjustedDuration = this.state.duration / value;\n this.setState({ speed: value, adjustedDuration });\n };\n\n private _onToggleLoop = () => {\n this.setState((prevState) => ({ loop: !prevState.loop }));\n };\n\n private _formatTime = (ms: number) => {\n const date = new Date(ms);\n const amLabel = UiComponents.translate(\"time.am\");\n const pmLabel = UiComponents.translate(\"time.pm\");\n // convert project date to browser locale date\n const localTime = adjustDateToTimezone(\n date,\n this.props.dataProvider.timeZoneOffset * 60\n );\n let hours = localTime.getHours();\n const minutes = date.getMinutes();\n const abbrev = hours < 12 ? amLabel : hours === 24 ? amLabel : pmLabel;\n hours = hours > 12 ? hours - 12 : hours;\n const hoursStr = hours.toLocaleString(undefined, {\n minimumIntegerDigits: 2,\n });\n const minutesStr = minutes.toLocaleString(undefined, {\n minimumIntegerDigits: 2,\n });\n return `${hoursStr}:${minutesStr} ${abbrev}`;\n };\n\n public getLocalTime(ticks: number): Date {\n const projectTime = new Date(ticks);\n // convert project date to browser locale date\n return adjustDateToTimezone(\n projectTime,\n this.props.dataProvider.timeZoneOffset * 60\n );\n }\n\n public override render() {\n const { dataProvider } = this.props;\n const {\n speed: currentSpeed,\n loop,\n currentTimeOffsetMs,\n sunRiseOffsetMs,\n sunSetOffsetMs,\n } = this.state;\n const months = [\n UiComponents.translate(\"month.short.january\"),\n UiComponents.translate(\"month.short.february\"),\n UiComponents.translate(\"month.short.march\"),\n UiComponents.translate(\"month.short.april\"),\n UiComponents.translate(\"month.short.may\"),\n UiComponents.translate(\"month.short.june\"),\n UiComponents.translate(\"month.short.july\"),\n UiComponents.translate(\"month.short.august\"),\n UiComponents.translate(\"month.short.september\"),\n UiComponents.translate(\"month.short.october\"),\n UiComponents.translate(\"month.short.november\"),\n UiComponents.translate(\"month.short.december\"),\n ];\n\n const localTime = this.getLocalTime(\n this.state.dayStartMs + this.state.currentTimeOffsetMs\n );\n const formattedTime = this._formatTime(\n dataProvider.dayStartMs + currentTimeOffsetMs\n );\n const formattedDate = `${\n months[localTime.getMonth()]\n }, ${localTime.getDate()}`;\n\n return (\n <div className=\"solar-timeline-wrapper\">\n <Flex flexWrap=\"wrap\" gap=\"none\" className=\"solar-timeline-start\">\n <PlayButton\n isPlaying={this.state.isPlaying}\n onPlay={this._onPlay}\n onPause={this._onPause}\n />\n <Popover\n content={\n <DatePicker\n date={localTime}\n onChange={this._onDateChange}\n showTime\n use12Hours\n />\n }\n visible={this.state.isDateOpened}\n onVisibleChange={(isDateOpened) => {\n this.setState({ isDateOpened });\n }}\n placement=\"top\"\n middleware={{\n offset,\n }}\n >\n <CalendarButton\n onClick={() => {\n const isDateOpened = !this.state.isDateOpened;\n this.setState({ isDateOpened });\n }}\n >\n {formattedDate} @ {formattedTime}\n </CalendarButton>\n </Popover>\n </Flex>\n\n <Timeline\n dayStartMs={dataProvider.dayStartMs}\n sunSetOffsetMs={sunSetOffsetMs}\n sunRiseOffsetMs={sunRiseOffsetMs}\n currentTimeOffsetMs={currentTimeOffsetMs}\n onChange={this._onChange}\n onUpdate={this._onUpdate}\n formatTime={this._formatTime}\n isPlaying={this.state.isPlaying}\n />\n\n <Flex\n justifyContent=\"flex-end\"\n flexWrap=\"wrap\"\n gap=\"none\"\n className=\"solar-timeline-end\"\n >\n <VisuallyHidden>\n <Label htmlFor=\"speed\">Timeline speed</Label>\n </VisuallyHidden>\n <Tooltip\n content={UiIModelComponents.translate(\"solartimeline.speed\")}\n >\n <Select\n native\n styleType=\"borderless\"\n triggerProps={{\n name: \"speed\",\n }}\n onChange={(newValue) => this._onSpeedChange(Number(newValue))}\n value={currentSpeed.toString()}\n options={this._speeds.map((speed) => ({\n value: speed.toString(),\n label: `${speed}x`,\n }))}\n />\n </Tooltip>\n\n <IconButton\n styleType=\"borderless\"\n label={UiIModelComponents.translate(\"timeline.repeat\")}\n onClick={this._onToggleLoop}\n isActive={loop}\n >\n <SvgLoop />\n </IconButton>\n\n <Popover\n content={\n <ColorPicker\n selectedColor={this.state.shadowColor.colors}\n onChangeComplete={(color) => {\n const colorDef = ColorDef.create(color.toTbgr());\n this.setState(\n { shadowColor: colorDef },\n () => (this.props.dataProvider.shadowColor = colorDef)\n );\n }}\n >\n <Text variant=\"title\" as=\"h2\" style={{ textAlign: \"center\" }}>\n {UiIModelComponents.translate(\"solarsettings.shadowcolor\")}\n </Text>\n <ColorBuilder />\n <ColorInputPanel defaultColorFormat=\"hsl\" />\n <ColorPalette\n colors={this._presetColors.map((color) => color.colors)}\n />\n </ColorPicker>\n }\n placement=\"top\"\n middleware={{\n offset,\n }}\n >\n <IconButton\n styleType=\"borderless\"\n data-testid=\"shadow-settings-button\"\n label={UiIModelComponents.translate(\"timeline.settings\")}\n onClick={this._onOpenSettingsPopup}\n >\n <SvgSettings />\n </IconButton>\n </Popover>\n </Flex>\n </div>\n );\n }\n}\n\ninterface CalendarButtonProps {\n children?: React.ReactNode;\n onClick?: () => void;\n}\n\nconst CalendarButton = React.forwardRef<HTMLButtonElement, CalendarButtonProps>(\n function CalendarButton({ children, onClick }, ref) {\n const { translate } = useTranslation();\n const tooltip = translate(\"solartimeline.dateTime\");\n\n return (\n <Tooltip content={tooltip}>\n <Button\n styleType=\"borderless\"\n startIcon={<SvgCalendar />}\n data-testid=\"solar-date-time-button\"\n title={tooltip}\n onClick={onClick}\n ref={ref}\n >\n <span className=\"solar-timeline-date-time\">{children}</span>\n </Button>\n </Tooltip>\n );\n }\n);\n"]}
|
|
1
|
+
{"version":3,"file":"SolarTimeline.js","sourceRoot":"","sources":["../../../src/imodel-components-react/timeline/SolarTimeline.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,sBAAsB,CAAC;AAC9B,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAE3D,OAAO,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAC7E,OAAO,EACL,MAAM,EACN,YAAY,EACZ,eAAe,EACf,YAAY,EACZ,WAAW,EACX,UAAU,EACV,IAAI,EACJ,IAAI,EACJ,UAAU,EACV,KAAK,EACL,OAAO,EACP,MAAM,EACN,MAAM,EACN,IAAI,EACJ,OAAO,EACP,cAAc,GACf,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,WAAW,EACX,OAAO,EACP,OAAO,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AoB;wBAElC,oBAAC,WAAW,OAAG,CACJ,CACL,CACL,CACH,CACP,CAAC;IACJ,CAAC;CACF;AAOD,MAAM,cAAc,GAAG,KAAK,CAAC,UAAU,CACrC,SAAS,cAAc,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,GAAG;IAChD,MAAM,EAAE,SAAS,EAAE,GAAG,cAAc,EAAE,CAAC;IACvC,MAAM,OAAO,GAAG,SAAS,CAAC,wBAAwB,CAAC,CAAC;IAEpD,OAAO,CACL,oBAAC,OAAO,IAAC,OAAO,EAAE,OAAO;QACvB,oBAAC,MAAM,IACL,SAAS,EAAC,YAAY,EACtB,SAAS,EAAE,oBAAC,WAAW,OAAG,iBACd,wBAAwB,EACpC,KAAK,EAAE,OAAO,EACd,OAAO,EAAE,OAAO,EAChB,GAAG,EAAE,GAAG;YAER,8BAAM,SAAS,EAAC,0BAA0B,IAAE,QAAQ,CAAQ,CACrD,CACD,CACX,CAAC;AACJ,CAAC,CACF,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Timeline\n */\n\nimport \"./SolarTimeline.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport { ColorByName, ColorDef } from \"@itwin/core-common\";\nimport type { CommonProps } from \"@itwin/core-react\";\nimport { adjustDateToTimezone, UiComponents } from \"@itwin/components-react\";\nimport {\n Button,\n ColorBuilder,\n ColorInputPanel,\n ColorPalette,\n ColorPicker,\n DatePicker,\n Flex,\n Icon,\n IconButton,\n Label,\n Popover,\n Select,\n Slider,\n Text,\n Tooltip,\n VisuallyHidden,\n} from \"@itwin/itwinui-react\";\nimport {\n SvgCalendar,\n SvgLoop,\n SvgMoon,\n SvgSettings,\n SvgSun,\n} from \"@itwin/itwinui-icons-react\";\nimport type { SolarDataProvider } from \"./interfaces.js\";\nimport { UiIModelComponents } from \"../UiIModelComponents.js\";\nimport { PlayButton } from \"./PlayButton.js\";\nimport { useTranslation } from \"../useTranslation.js\";\n\nconst msPerMinute = 1000 * 60;\nconst msPerHour = msPerMinute * 60;\nconst defaultPlaybackDuration = 40 * 1000;\n\nconst offset = 6;\n\n// eslint-disable-next-line @typescript-eslint/no-deprecated\ninterface TimelineProps extends CommonProps {\n dayStartMs: number;\n sunRiseOffsetMs: number;\n sunSetOffsetMs: number;\n currentTimeOffsetMs: number;\n isPlaying: boolean;\n formatTick?: (ms: number) => string;\n formatTime: (ms: number) => string;\n onChange?: (values: ReadonlyArray<number>) => void;\n onUpdate?: (values: ReadonlyArray<number>) => void;\n}\n\nfunction Timeline(props: TimelineProps) {\n const {\n formatTick,\n formatTime,\n onChange,\n onUpdate,\n dayStartMs,\n sunSetOffsetMs,\n sunRiseOffsetMs,\n currentTimeOffsetMs,\n } = props;\n\n const tooltipContent = formatTime(dayStartMs + currentTimeOffsetMs);\n\n const className = classnames(\n \"solar-timeline\",\n props.className,\n formatTick && \"showticks\"\n );\n const sunRiseStr = formatTime(dayStartMs + sunRiseOffsetMs);\n const sunSetStr = formatTime(dayStartMs + sunSetOffsetMs);\n return (\n <div className={className}>\n <VisuallyHidden>Solar timeline</VisuallyHidden>\n <Slider\n thumbProps={() => ({ \"aria-labelledby\": \"timeline\" })}\n step={msPerMinute}\n min={sunRiseOffsetMs}\n max={sunSetOffsetMs}\n minLabel={\n <Tooltip content={sunRiseStr}>\n <Icon>\n <SvgSun />\n </Icon>\n </Tooltip>\n }\n maxLabel={\n <Tooltip content={sunSetStr}>\n <Icon>\n <SvgMoon />\n </Icon>\n </Tooltip>\n }\n onUpdate={onUpdate}\n onChange={onChange}\n values={[currentTimeOffsetMs]}\n tooltipProps={() => ({\n content: tooltipContent,\n })}\n />\n </div>\n );\n}\n\ninterface SolarTimelineComponentProps {\n dataProvider: SolarDataProvider; // provides date, sunrise, sunset in ms, also contains timezone offset from UTC, and updates the display style to current time.\n onPlayPause?: (playing: boolean) => void; // callback triggered when play/pause button is pressed\n duration?: number; // playback duration in milliseconds\n speed?: number;\n}\n\ninterface SolarTimelineComponentState {\n isPlaying: boolean; // timeline is currently playing or paused\n isDateOpened: boolean; // date picker is opened\n isSettingsOpened: boolean; // settings popup is opened\n dayStartMs: number;\n sunRiseOffsetMs: number;\n sunSetOffsetMs: number;\n sunDeltaMs: number;\n currentTimeOffsetMs: number;\n speed: number;\n loop: boolean;\n shadowColor: ColorDef;\n duration: number; // playback duration in milliseconds\n adjustedDuration: number; // playback duration in milliseconds/ speed\n}\n\n/** Solar Timeline\n * @alpha\n */\nexport class SolarTimeline extends React.PureComponent<\n SolarTimelineComponentProps,\n SolarTimelineComponentState\n> {\n private _requestFrame = 0;\n private _unmounted = false;\n private _timeLastCycle = 0;\n private _totalPlayTime = 0;\n\n private readonly _presetColors = [\n ColorDef.create(ColorByName.grey),\n ColorDef.create(ColorByName.lightGrey),\n ColorDef.create(ColorByName.darkGrey),\n ColorDef.create(ColorByName.lightBlue),\n ColorDef.create(ColorByName.lightGreen),\n ColorDef.create(ColorByName.darkGreen),\n ColorDef.create(ColorByName.tan),\n ColorDef.create(ColorByName.darkBrown),\n ];\n\n private readonly _speeds = [1, 2, 3, 4, 5, 6];\n\n constructor(props: SolarTimelineComponentProps) {\n super(props);\n\n const dayStartMs = this.props.dataProvider.dayStartMs;\n const sunRiseOffsetMs =\n this.props.dataProvider.sunrise.getTime() - dayStartMs;\n const sunSetOffsetMs =\n this.props.dataProvider.sunset.getTime() - dayStartMs;\n const sunDeltaMs = sunSetOffsetMs - sunRiseOffsetMs;\n const sunOffsetMs =\n this.props.dataProvider.timeOfDay.getTime() - dayStartMs;\n const currentTimeOffsetMs = this.ensureRange(\n sunOffsetMs,\n sunRiseOffsetMs,\n sunSetOffsetMs\n );\n const shadowColor = this.props.dataProvider.shadowColor;\n const duration = this.props.duration\n ? this.props.duration\n : defaultPlaybackDuration;\n const speed = this.props.speed ? this.props.speed : 2;\n const adjustedDuration = duration / speed;\n this.setPlaybackTimeBySunTime(\n currentTimeOffsetMs,\n sunRiseOffsetMs,\n sunDeltaMs,\n adjustedDuration\n );\n\n this.state = {\n isDateOpened: false,\n isSettingsOpened: false,\n isPlaying: false,\n dayStartMs,\n sunRiseOffsetMs,\n sunSetOffsetMs,\n sunDeltaMs,\n currentTimeOffsetMs,\n speed,\n loop: false,\n shadowColor,\n duration,\n adjustedDuration,\n };\n }\n\n public override componentWillUnmount() {\n window.cancelAnimationFrame(this._requestFrame);\n this._unmounted = true;\n }\n\n // recursively update the animation until we hit the end or the pause button is clicked\n private _updateAnimation = (_timestamp: number) => {\n if (!this.state.isPlaying || this._unmounted) {\n window.cancelAnimationFrame(this._requestFrame);\n return;\n }\n\n const currentTime = new Date().getTime();\n this._totalPlayTime += currentTime - this._timeLastCycle;\n this._timeLastCycle = currentTime;\n let percentComplete = this._totalPlayTime / this.state.adjustedDuration;\n if (percentComplete > 1) percentComplete = 1;\n\n let newPlayingState = true;\n\n // calculate the next sun time base on the percentage playback complete - should be int value as that is step amount for slider\n let nextSunOffset = Math.floor(\n this.state.sunRiseOffsetMs + percentComplete * this.state.sunDeltaMs\n );\n\n if (percentComplete > 0.99) {\n if (!this.state.loop) {\n newPlayingState = false;\n nextSunOffset = this.state.sunSetOffsetMs;\n window.cancelAnimationFrame(this._requestFrame);\n } else {\n nextSunOffset = this.state.sunRiseOffsetMs;\n this._totalPlayTime = 0;\n }\n }\n\n if (this.props.dataProvider.onTimeChanged) {\n const currentSunTime = new Date(this.state.dayStartMs + nextSunOffset);\n this.props.dataProvider.onTimeChanged(currentSunTime);\n }\n\n this.setState(\n { isPlaying: newPlayingState, currentTimeOffsetMs: nextSunOffset },\n () => {\n if (newPlayingState)\n this._requestFrame = window.requestAnimationFrame(\n this._updateAnimation\n );\n }\n );\n };\n\n private _play(sunTimeMs: number) {\n this._timeLastCycle = new Date().getTime();\n\n // start playing\n this.setState({ isPlaying: true, currentTimeOffsetMs: sunTimeMs }, () => {\n this._requestFrame = window.requestAnimationFrame(this._updateAnimation);\n if (this.props.onPlayPause) this.props.onPlayPause(true);\n });\n }\n\n // user clicked pause button\n private _onPause = () => {\n if (!this.state.isPlaying) return;\n\n const currentTime = new Date().getTime();\n this._totalPlayTime += currentTime - this._timeLastCycle;\n\n // stop requesting frames\n window.cancelAnimationFrame(this._requestFrame);\n\n // stop playing\n this.setState({ isPlaying: false });\n\n if (this.props.onPlayPause) this.props.onPlayPause(false);\n };\n\n // user clicked play button\n private _onPlay = () => {\n if (this.state.isPlaying) return;\n\n if (\n this.state.currentTimeOffsetMs >= this.state.sunSetOffsetMs ||\n this.state.currentTimeOffsetMs <= this.state.sunRiseOffsetMs\n ) {\n this._totalPlayTime = 0;\n this._play(this.state.sunRiseOffsetMs);\n } else {\n this._play(this.state.currentTimeOffsetMs);\n }\n };\n\n private setPlaybackTimeBySunTime(\n sunOffsetMs: number,\n sunRiseOffsetMs: number,\n sunDeltaMs: number,\n adjustedDuration?: number\n ) {\n this._totalPlayTime =\n ((sunOffsetMs - sunRiseOffsetMs) / sunDeltaMs) *\n (adjustedDuration ? adjustedDuration : this.state.adjustedDuration);\n }\n\n private _onDateChange = (newDate: Date) => {\n this.props.dataProvider.setDateAndTime(newDate);\n\n const dayStartMs = this.props.dataProvider.dayStartMs;\n const sunRiseOffsetMs =\n this.props.dataProvider.sunrise.getTime() - dayStartMs;\n const sunSetOffsetMs =\n this.props.dataProvider.sunset.getTime() - dayStartMs;\n const sunDeltaMs = sunSetOffsetMs - sunRiseOffsetMs;\n\n /** call dataProvider to update display style */\n // this.props.dataProvider.onTimeChanged?.(this.props.dataProvider.timeOfDay);\n\n // Update time\n const newHours = newDate.getHours();\n const newMinutes = newDate.getMinutes();\n const newSunTime = newHours * msPerHour + newMinutes * msPerMinute;\n const dateWithNewTime = new Date(dayStartMs + newSunTime);\n // this.props.dataProvider.setDateAndTime(dateWithNewTime, true);\n\n const currentTimeOffsetMs = this.ensureRange(\n newSunTime,\n sunRiseOffsetMs,\n sunSetOffsetMs\n );\n this.setPlaybackTimeBySunTime(\n currentTimeOffsetMs,\n sunRiseOffsetMs,\n sunDeltaMs\n );\n this._timeLastCycle = new Date().getTime();\n\n this.props.dataProvider.onTimeChanged?.(dateWithNewTime);\n this.setState({\n dayStartMs,\n sunRiseOffsetMs,\n sunSetOffsetMs,\n currentTimeOffsetMs,\n sunDeltaMs,\n isDateOpened: false,\n });\n };\n\n private _onCloseSettingsPopup = () => {\n this.setState({ isSettingsOpened: false });\n };\n\n private _onOpenSettingsPopup = () => {\n this.setState((prevState) => ({\n isSettingsOpened: !prevState.isSettingsOpened,\n }));\n };\n\n private ensureRange(value: number, min: number, max: number): number {\n return Math.max(Math.min(value, max), min);\n }\n\n private processSunTimeChange(sunTime: number) {\n if (sunTime === this.state.currentTimeOffsetMs) return;\n\n const currentTimeOffsetMs = this.ensureRange(\n sunTime,\n this.state.sunRiseOffsetMs,\n this.state.sunSetOffsetMs\n );\n\n if (this.props.dataProvider.onTimeChanged) {\n const currentSunTime = new Date(\n this.state.dayStartMs + currentTimeOffsetMs\n );\n this.props.dataProvider.onTimeChanged(currentSunTime);\n }\n\n this.setState({ currentTimeOffsetMs }, () => {\n const currentTime = new Date().getTime();\n this._timeLastCycle = currentTime;\n const percentComplete =\n (currentTimeOffsetMs - this.state.sunRiseOffsetMs) /\n this.state.sunDeltaMs;\n this._totalPlayTime = percentComplete * this.state.adjustedDuration;\n });\n }\n\n private _onUpdate = (values: ReadonlyArray<number>) => {\n if (!this.state.isPlaying) this.processSunTimeChange(values[0]);\n };\n\n private _onChange = (values: ReadonlyArray<number>) => {\n if (!this.state.isPlaying) this.processSunTimeChange(values[0]);\n };\n\n private _onSpeedChange = (value: number) => {\n const adjustedDuration = this.state.duration / value;\n this.setState({ speed: value, adjustedDuration });\n };\n\n private _onToggleLoop = () => {\n this.setState((prevState) => ({ loop: !prevState.loop }));\n };\n\n private _formatTime = (ms: number) => {\n const date = new Date(ms);\n const amLabel = UiComponents.translate(\"time.am\");\n const pmLabel = UiComponents.translate(\"time.pm\");\n // convert project date to browser locale date\n const localTime = adjustDateToTimezone(\n date,\n this.props.dataProvider.timeZoneOffset * 60\n );\n let hours = localTime.getHours();\n const minutes = date.getMinutes();\n const abbrev = hours < 12 ? amLabel : hours === 24 ? amLabel : pmLabel;\n hours = hours > 12 ? hours - 12 : hours;\n const hoursStr = hours.toLocaleString(undefined, {\n minimumIntegerDigits: 2,\n });\n const minutesStr = minutes.toLocaleString(undefined, {\n minimumIntegerDigits: 2,\n });\n return `${hoursStr}:${minutesStr} ${abbrev}`;\n };\n\n public getLocalTime(ticks: number): Date {\n const projectTime = new Date(ticks);\n // convert project date to browser locale date\n return adjustDateToTimezone(\n projectTime,\n this.props.dataProvider.timeZoneOffset * 60\n );\n }\n\n public override render() {\n const { dataProvider } = this.props;\n const {\n speed: currentSpeed,\n loop,\n currentTimeOffsetMs,\n sunRiseOffsetMs,\n sunSetOffsetMs,\n } = this.state;\n const months = [\n UiComponents.translate(\"month.short.january\"),\n UiComponents.translate(\"month.short.february\"),\n UiComponents.translate(\"month.short.march\"),\n UiComponents.translate(\"month.short.april\"),\n UiComponents.translate(\"month.short.may\"),\n UiComponents.translate(\"month.short.june\"),\n UiComponents.translate(\"month.short.july\"),\n UiComponents.translate(\"month.short.august\"),\n UiComponents.translate(\"month.short.september\"),\n UiComponents.translate(\"month.short.october\"),\n UiComponents.translate(\"month.short.november\"),\n UiComponents.translate(\"month.short.december\"),\n ];\n\n const localTime = this.getLocalTime(\n this.state.dayStartMs + this.state.currentTimeOffsetMs\n );\n const formattedTime = this._formatTime(\n dataProvider.dayStartMs + currentTimeOffsetMs\n );\n const formattedDate = `${\n months[localTime.getMonth()]\n }, ${localTime.getDate()}`;\n\n return (\n <div className=\"solar-timeline-wrapper\">\n <Flex flexWrap=\"wrap\" gap=\"none\" className=\"solar-timeline-start\">\n <PlayButton\n isPlaying={this.state.isPlaying}\n onPlay={this._onPlay}\n onPause={this._onPause}\n />\n <Popover\n content={\n <DatePicker\n date={localTime}\n onChange={this._onDateChange}\n showTime\n use12Hours\n />\n }\n visible={this.state.isDateOpened}\n onVisibleChange={(isDateOpened) => {\n this.setState({ isDateOpened });\n }}\n placement=\"top\"\n middleware={{\n offset,\n }}\n >\n <CalendarButton\n onClick={() => {\n const isDateOpened = !this.state.isDateOpened;\n this.setState({ isDateOpened });\n }}\n >\n {formattedDate} @ {formattedTime}\n </CalendarButton>\n </Popover>\n </Flex>\n\n <Timeline\n dayStartMs={dataProvider.dayStartMs}\n sunSetOffsetMs={sunSetOffsetMs}\n sunRiseOffsetMs={sunRiseOffsetMs}\n currentTimeOffsetMs={currentTimeOffsetMs}\n onChange={this._onChange}\n onUpdate={this._onUpdate}\n formatTime={this._formatTime}\n isPlaying={this.state.isPlaying}\n />\n\n <Flex\n justifyContent=\"flex-end\"\n flexWrap=\"wrap\"\n gap=\"none\"\n className=\"solar-timeline-end\"\n >\n <VisuallyHidden>\n <Label htmlFor=\"speed\">Timeline speed</Label>\n </VisuallyHidden>\n <Tooltip\n content={UiIModelComponents.translate(\"solartimeline.speed\")}\n >\n <Select\n native\n styleType=\"borderless\"\n triggerProps={{\n name: \"speed\",\n }}\n onChange={(newValue) => this._onSpeedChange(Number(newValue))}\n value={currentSpeed.toString()}\n options={this._speeds.map((speed) => ({\n value: speed.toString(),\n label: `${speed}x`,\n }))}\n />\n </Tooltip>\n\n <IconButton\n styleType=\"borderless\"\n label={UiIModelComponents.translate(\"timeline.repeat\")}\n onClick={this._onToggleLoop}\n isActive={loop}\n >\n <SvgLoop />\n </IconButton>\n\n <Popover\n content={\n <ColorPicker\n selectedColor={this.state.shadowColor.colors}\n onChangeComplete={(color) => {\n const colorDef = ColorDef.create(color.toTbgr());\n this.setState(\n { shadowColor: colorDef },\n () => (this.props.dataProvider.shadowColor = colorDef)\n );\n }}\n >\n <Text variant=\"title\" as=\"h2\" style={{ textAlign: \"center\" }}>\n {UiIModelComponents.translate(\"solarsettings.shadowcolor\")}\n </Text>\n <ColorBuilder />\n <ColorInputPanel defaultColorFormat=\"hsl\" />\n <ColorPalette\n colors={this._presetColors.map((color) => color.colors)}\n />\n </ColorPicker>\n }\n placement=\"top\"\n middleware={{\n offset,\n }}\n >\n <IconButton\n styleType=\"borderless\"\n data-testid=\"shadow-settings-button\"\n label={UiIModelComponents.translate(\"timeline.settings\")}\n onClick={this._onOpenSettingsPopup}\n >\n <SvgSettings />\n </IconButton>\n </Popover>\n </Flex>\n </div>\n );\n }\n}\n\ninterface CalendarButtonProps {\n children?: React.ReactNode;\n onClick?: () => void;\n}\n\nconst CalendarButton = React.forwardRef<HTMLButtonElement, CalendarButtonProps>(\n function CalendarButton({ children, onClick }, ref) {\n const { translate } = useTranslation();\n const tooltip = translate(\"solartimeline.dateTime\");\n\n return (\n <Tooltip content={tooltip}>\n <Button\n styleType=\"borderless\"\n startIcon={<SvgCalendar />}\n data-testid=\"solar-date-time-button\"\n title={tooltip}\n onClick={onClick}\n ref={ref}\n >\n <span className=\"solar-timeline-date-time\">{children}</span>\n </Button>\n </Tooltip>\n );\n }\n);\n"]}
|
|
@@ -55,6 +55,7 @@ export class ViewIdChangedEvent extends UiEvent {
|
|
|
55
55
|
* @public
|
|
56
56
|
*/
|
|
57
57
|
export class ViewportComponentEvents {
|
|
58
|
+
static _removeListener;
|
|
58
59
|
static initialize() {
|
|
59
60
|
if (undefined !== this._removeListener)
|
|
60
61
|
return;
|
|
@@ -68,6 +69,21 @@ export class ViewportComponentEvents {
|
|
|
68
69
|
this._removeListener = undefined;
|
|
69
70
|
}
|
|
70
71
|
}
|
|
72
|
+
static face = Face.None;
|
|
73
|
+
static origin = Point3d.createZero();
|
|
74
|
+
static extents = Vector3d.createZero();
|
|
75
|
+
static rotationMatrix = Matrix3d.createIdentity();
|
|
76
|
+
static onDrawingViewportChangeEvent = new DrawingViewportChangeEvent(); // eslint-disable-line @typescript-eslint/no-deprecated
|
|
77
|
+
static onCubeRotationChangeEvent = new CubeRotationChangeEvent(); // eslint-disable-line @typescript-eslint/no-deprecated
|
|
78
|
+
static onStandardRotationChangeEvent = new StandardRotationChangeEvent(); // eslint-disable-line @typescript-eslint/no-deprecated
|
|
79
|
+
static onViewRotationChangeEvent = new ViewRotationChangeEvent(); // eslint-disable-line @typescript-eslint/no-deprecated
|
|
80
|
+
static onViewClassFullNameChangedEvent = new ViewClassFullNameChangedEvent(); // eslint-disable-line @typescript-eslint/no-deprecated
|
|
81
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
82
|
+
static onViewIdChangedEvent = new ViewIdChangedEvent();
|
|
83
|
+
static _handleSelectedViewportChanged = (args) => {
|
|
84
|
+
if (args.current)
|
|
85
|
+
ViewportComponentEvents.setViewMatrix(args.current);
|
|
86
|
+
};
|
|
71
87
|
static setCubeMatrix(rotMatrix, face = Face.None, complete = false) {
|
|
72
88
|
this.rotationMatrix.setFrom(rotMatrix);
|
|
73
89
|
this.face = face;
|
|
@@ -91,19 +107,4 @@ export class ViewportComponentEvents {
|
|
|
91
107
|
});
|
|
92
108
|
}
|
|
93
109
|
}
|
|
94
|
-
ViewportComponentEvents.face = Face.None;
|
|
95
|
-
ViewportComponentEvents.origin = Point3d.createZero();
|
|
96
|
-
ViewportComponentEvents.extents = Vector3d.createZero();
|
|
97
|
-
ViewportComponentEvents.rotationMatrix = Matrix3d.createIdentity();
|
|
98
|
-
ViewportComponentEvents.onDrawingViewportChangeEvent = new DrawingViewportChangeEvent(); // eslint-disable-line @typescript-eslint/no-deprecated
|
|
99
|
-
ViewportComponentEvents.onCubeRotationChangeEvent = new CubeRotationChangeEvent(); // eslint-disable-line @typescript-eslint/no-deprecated
|
|
100
|
-
ViewportComponentEvents.onStandardRotationChangeEvent = new StandardRotationChangeEvent(); // eslint-disable-line @typescript-eslint/no-deprecated
|
|
101
|
-
ViewportComponentEvents.onViewRotationChangeEvent = new ViewRotationChangeEvent(); // eslint-disable-line @typescript-eslint/no-deprecated
|
|
102
|
-
ViewportComponentEvents.onViewClassFullNameChangedEvent = new ViewClassFullNameChangedEvent(); // eslint-disable-line @typescript-eslint/no-deprecated
|
|
103
|
-
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
104
|
-
ViewportComponentEvents.onViewIdChangedEvent = new ViewIdChangedEvent();
|
|
105
|
-
ViewportComponentEvents._handleSelectedViewportChanged = (args) => {
|
|
106
|
-
if (args.current)
|
|
107
|
-
ViewportComponentEvents.setViewMatrix(args.current);
|
|
108
|
-
};
|
|
109
110
|
//# sourceMappingURL=ViewportComponentEvents.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ViewportComponentEvents.js","sourceRoot":"","sources":["../../../src/imodel-components-react/viewport/ViewportComponentEvents.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAEnE,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,IAAI,EAAE,MAAM,2BAA2B,CAAC;AAajD;;;GAGG;AACH,4DAA4D;AAC5D,MAAM,OAAO,0BAA2B,SAAQ,OAAuC;CAAG;AAY1F;;;GAGG;AACH,4DAA4D;AAC5D,MAAM,OAAO,uBAAwB,SAAQ,OAAoC;CAAG;AAUpF;;;GAGG;AACH,4DAA4D;AAC5D,MAAM,OAAO,2BAA4B,SAAQ,OAAwC;CAAG;AAW5F;;;GAGG;AACH,4DAA4D;AAC5D,MAAM,OAAO,uBAAwB,SAAQ,OAAoC;CAAG;AAYpF;;;GAGG;AACH,4DAA4D;AAC5D,MAAM,OAAO,6BAA8B,SAAQ,OAA0C;CAAG;AAYhG;;;GAGG;AACH,4DAA4D;AAC5D,MAAM,OAAO,kBAAmB,SAAQ,OAA+B;CAAG;AAE1E;;GAEG;AACH,MAAM,OAAO,uBAAuB;IAG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C,CAAC;gBAC/C,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC;YACnD,CAAC;YACD,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;YAE/C,IAAI,CAAC,yBAAyB,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,aAAa,EAAE,CAAC,CAAC;QACnE,CAAC,CAAC,CAAC;IACL,CAAC;;AA3Da,4BAAI,GAAG,IAAI,CAAC,IAAI,CAAC;AACR,8BAAM,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;AAC9B,+BAAO,GAAG,QAAQ,CAAC,UAAU,EAAE,CAAC;AAChC,sCAAc,GAAG,QAAQ,CAAC,cAAc,EAAE,CAAC;AAC3C,oDAA4B,GACjD,IAAI,0BAA0B,EAAE,CAAC,CAAC,uDAAuD;AACpE,iDAAyB,GAC9C,IAAI,uBAAuB,EAAE,CAAC,CAAC,uDAAuD;AACjE,qDAA6B,GAClD,IAAI,2BAA2B,EAAE,CAAC,CAAC,uDAAuD;AACrE,iDAAyB,GAC9C,IAAI,uBAAuB,EAAE,CAAC,CAAC,uDAAuD;AACjE,uDAA+B,GACpD,IAAI,6BAA6B,EAAE,CAAC,CAAC,uDAAuD;AAC9F,4DAA4D;AACrC,4CAAoB,GAAG,IAAI,kBAAkB,EAAE,CAAC;AAExD,sDAA8B,GAEzC,CAAC,IAAI,EAAE,EAAE;IACX,IAAI,IAAI,CAAC,OAAO;QAAE,uBAAuB,CAAC,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;AACxE,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Viewport\n */\n\nimport { Matrix3d, Point3d, Vector3d } from \"@itwin/core-geometry\";\nimport type { StandardViewId, Viewport } from \"@itwin/core-frontend\";\nimport { IModelApp } from \"@itwin/core-frontend\";\nimport { UiEvent } from \"@itwin/appui-abstract\";\nimport { Face } from \"../navigationaids/Cube.js\";\nimport type { ListenerType } from \"@itwin/core-react/internal\";\n\n/** Arguments for [[DrawingViewportChangeEvent]]\n * @public\n * @deprecated in 4.13.0. Event args are inferred from a listener. If explicit type is needed use a type helper.\n */\nexport interface DrawingViewportChangeEventArgs {\n rotation: Matrix3d;\n origin: Point3d;\n complete: boolean;\n}\n\n/** Drawing View Change event\n * @public\n * @deprecated in 4.13.0. This class should not be used by applications to instantiate objects.\n */\n// eslint-disable-next-line @typescript-eslint/no-deprecated\nexport class DrawingViewportChangeEvent extends UiEvent<DrawingViewportChangeEventArgs> {}\n\n/** Arguments for [[CubeRotationChangeEvent]]\n * @public\n * @deprecated in 4.13.0. Event args are inferred from a listener. If explicit type is needed use a type helper.\n */\nexport interface CubeRotationChangeEventArgs {\n rotMatrix: Matrix3d;\n face: Face;\n complete?: boolean;\n}\n\n/** 3d Cube Rotation Change event\n * @public\n * @deprecated in 4.13.0. This class should not be used by applications to instantiate objects.\n */\n// eslint-disable-next-line @typescript-eslint/no-deprecated\nexport class CubeRotationChangeEvent extends UiEvent<CubeRotationChangeEventArgs> {}\n\n/** Arguments for [[StandardRotationChangeEvent]]\n * @public\n * @deprecated in 4.13.0. Event args are inferred from a listener. If explicit type is needed use a type helper.\n */\nexport interface StandardRotationChangeEventArgs {\n standardRotation: StandardViewId;\n}\n\n/** Standard Rotation Change event\n * @public\n * @deprecated in 4.13.0. This class should not be used by applications to instantiate objects.\n */\n// eslint-disable-next-line @typescript-eslint/no-deprecated\nexport class StandardRotationChangeEvent extends UiEvent<StandardRotationChangeEventArgs> {}\n\n/** Arguments for [[ViewRotationChangeEvent]]\n * @public\n * @deprecated in 4.13.0. Event args are inferred from a listener. If explicit type is needed use a type helper.\n */\nexport interface ViewRotationChangeEventArgs {\n viewport: Viewport;\n animationTime?: number;\n}\n\n/** View Rotation Change event\n * @public\n * @deprecated in 4.13.0. This class should not be used by applications to instantiate objects.\n */\n// eslint-disable-next-line @typescript-eslint/no-deprecated\nexport class ViewRotationChangeEvent extends UiEvent<ViewRotationChangeEventArgs> {}\n\n/** Arguments for [[ViewClassFullNameChangedEvent]]\n * @public\n * @deprecated in 4.13.0. Event args are inferred from a listener. If explicit type is needed use a type helper.\n */\nexport interface ViewClassFullNameChangedEventArgs {\n viewport: Viewport;\n oldName: string;\n newName: string;\n}\n\n/** View Class Full Name Change event\n * @public\n * @deprecated in 4.13.0. This class should not be used by applications to instantiate objects.\n */\n// eslint-disable-next-line @typescript-eslint/no-deprecated\nexport class ViewClassFullNameChangedEvent extends UiEvent<ViewClassFullNameChangedEventArgs> {}\n\n/** Arguments for [[ViewIdChangedEvent]]\n * @public\n * @deprecated in 4.13.0. Event args are inferred from a listener. If explicit type is needed use a type helper.\n */\nexport interface ViewIdChangedEventArgs {\n viewport: Viewport;\n oldId: string;\n newId: string;\n}\n\n/** View Id Change event\n * @public\n * @deprecated in 4.13.0. This class should not be used by applications to instantiate objects.\n */\n// eslint-disable-next-line @typescript-eslint/no-deprecated\nexport class ViewIdChangedEvent extends UiEvent<ViewIdChangedEventArgs> {}\n\n/** Viewport Rotation events and methods\n * @public\n */\nexport class ViewportComponentEvents {\n private static _removeListener?: () => void;\n\n public static initialize() {\n if (undefined !== this._removeListener) return;\n\n this._removeListener =\n IModelApp.viewManager.onSelectedViewportChanged.addListener(\n ViewportComponentEvents._handleSelectedViewportChanged\n );\n }\n\n /** @internal - for unit testing */\n public static terminate() {\n if (this._removeListener) {\n this._removeListener();\n this._removeListener = undefined;\n }\n }\n\n public static face = Face.None;\n public static readonly origin = Point3d.createZero();\n public static readonly extents = Vector3d.createZero();\n public static readonly rotationMatrix = Matrix3d.createIdentity();\n public static readonly onDrawingViewportChangeEvent =\n new DrawingViewportChangeEvent(); // eslint-disable-line @typescript-eslint/no-deprecated\n public static readonly onCubeRotationChangeEvent =\n new CubeRotationChangeEvent(); // eslint-disable-line @typescript-eslint/no-deprecated\n public static readonly onStandardRotationChangeEvent =\n new StandardRotationChangeEvent(); // eslint-disable-line @typescript-eslint/no-deprecated\n public static readonly onViewRotationChangeEvent =\n new ViewRotationChangeEvent(); // eslint-disable-line @typescript-eslint/no-deprecated\n public static readonly onViewClassFullNameChangedEvent =\n new ViewClassFullNameChangedEvent(); // eslint-disable-line @typescript-eslint/no-deprecated\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n public static readonly onViewIdChangedEvent = new ViewIdChangedEvent();\n\n private static _handleSelectedViewportChanged: ListenerType<\n typeof IModelApp.viewManager.onSelectedViewportChanged\n > = (args) => {\n if (args.current) ViewportComponentEvents.setViewMatrix(args.current);\n };\n\n public static setCubeMatrix(\n rotMatrix: Matrix3d,\n face = Face.None,\n complete: boolean = false\n ): void {\n this.rotationMatrix.setFrom(rotMatrix);\n this.face = face;\n this.onCubeRotationChangeEvent.emit({ rotMatrix, complete, face });\n }\n\n public static setDrawingViewportState(\n origin: Point3d,\n rotation: Matrix3d,\n complete: boolean = false\n ): void {\n this.onDrawingViewportChangeEvent.emit({ origin, rotation, complete });\n }\n\n public static setStandardRotation(standardRotation: StandardViewId): void {\n this.onStandardRotationChangeEvent.emit({ standardRotation });\n }\n\n public static setViewMatrix(\n viewport: Viewport,\n animationTime?: number\n ): void {\n // When handling onViewChanged, use setTimeout\n setTimeout(() => {\n if (viewport.view) {\n this.origin.setFrom(viewport.view.getOrigin());\n this.extents.setFrom(viewport.view.getExtents());\n }\n this.rotationMatrix.setFrom(viewport.rotation);\n\n this.onViewRotationChangeEvent.emit({ viewport, animationTime });\n });\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"ViewportComponentEvents.js","sourceRoot":"","sources":["../../../src/imodel-components-react/viewport/ViewportComponentEvents.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,OAAO,E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M,CAAC,mBAAmB,CAAC,gBAAgC;QAChE,IAAI,CAAC,6BAA6B,CAAC,IAAI,CAAC,EAAE,gBAAgB,EAAE,CAAC,CAAC;IAChE,CAAC;IAEM,MAAM,CAAC,aAAa,CACzB,QAAkB,EAClB,aAAsB;QAEtB,8CAA8C;QAC9C,UAAU,CAAC,GAAG,EAAE;YACd,IAAI,QAAQ,CAAC,IAAI,EAAE,CAAC;gBAClB,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC,CAAC;gBAC/C,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC;YACnD,CAAC;YACD,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;YAE/C,IAAI,CAAC,yBAAyB,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,aAAa,EAAE,CAAC,CAAC;QACnE,CAAC,CAAC,CAAC;IACL,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Viewport\n */\n\nimport { Matrix3d, Point3d, Vector3d } from \"@itwin/core-geometry\";\nimport type { StandardViewId, Viewport } from \"@itwin/core-frontend\";\nimport { IModelApp } from \"@itwin/core-frontend\";\nimport { UiEvent } from \"@itwin/appui-abstract\";\nimport { Face } from \"../navigationaids/Cube.js\";\nimport type { ListenerType } from \"@itwin/core-react/internal\";\n\n/** Arguments for [[DrawingViewportChangeEvent]]\n * @public\n * @deprecated in 4.13.0. Event args are inferred from a listener. If explicit type is needed use a type helper.\n */\nexport interface DrawingViewportChangeEventArgs {\n rotation: Matrix3d;\n origin: Point3d;\n complete: boolean;\n}\n\n/** Drawing View Change event\n * @public\n * @deprecated in 4.13.0. This class should not be used by applications to instantiate objects.\n */\n// eslint-disable-next-line @typescript-eslint/no-deprecated\nexport class DrawingViewportChangeEvent extends UiEvent<DrawingViewportChangeEventArgs> {}\n\n/** Arguments for [[CubeRotationChangeEvent]]\n * @public\n * @deprecated in 4.13.0. Event args are inferred from a listener. If explicit type is needed use a type helper.\n */\nexport interface CubeRotationChangeEventArgs {\n rotMatrix: Matrix3d;\n face: Face;\n complete?: boolean;\n}\n\n/** 3d Cube Rotation Change event\n * @public\n * @deprecated in 4.13.0. This class should not be used by applications to instantiate objects.\n */\n// eslint-disable-next-line @typescript-eslint/no-deprecated\nexport class CubeRotationChangeEvent extends UiEvent<CubeRotationChangeEventArgs> {}\n\n/** Arguments for [[StandardRotationChangeEvent]]\n * @public\n * @deprecated in 4.13.0. Event args are inferred from a listener. If explicit type is needed use a type helper.\n */\nexport interface StandardRotationChangeEventArgs {\n standardRotation: StandardViewId;\n}\n\n/** Standard Rotation Change event\n * @public\n * @deprecated in 4.13.0. This class should not be used by applications to instantiate objects.\n */\n// eslint-disable-next-line @typescript-eslint/no-deprecated\nexport class StandardRotationChangeEvent extends UiEvent<StandardRotationChangeEventArgs> {}\n\n/** Arguments for [[ViewRotationChangeEvent]]\n * @public\n * @deprecated in 4.13.0. Event args are inferred from a listener. If explicit type is needed use a type helper.\n */\nexport interface ViewRotationChangeEventArgs {\n viewport: Viewport;\n animationTime?: number;\n}\n\n/** View Rotation Change event\n * @public\n * @deprecated in 4.13.0. This class should not be used by applications to instantiate objects.\n */\n// eslint-disable-next-line @typescript-eslint/no-deprecated\nexport class ViewRotationChangeEvent extends UiEvent<ViewRotationChangeEventArgs> {}\n\n/** Arguments for [[ViewClassFullNameChangedEvent]]\n * @public\n * @deprecated in 4.13.0. Event args are inferred from a listener. If explicit type is needed use a type helper.\n */\nexport interface ViewClassFullNameChangedEventArgs {\n viewport: Viewport;\n oldName: string;\n newName: string;\n}\n\n/** View Class Full Name Change event\n * @public\n * @deprecated in 4.13.0. This class should not be used by applications to instantiate objects.\n */\n// eslint-disable-next-line @typescript-eslint/no-deprecated\nexport class ViewClassFullNameChangedEvent extends UiEvent<ViewClassFullNameChangedEventArgs> {}\n\n/** Arguments for [[ViewIdChangedEvent]]\n * @public\n * @deprecated in 4.13.0. Event args are inferred from a listener. If explicit type is needed use a type helper.\n */\nexport interface ViewIdChangedEventArgs {\n viewport: Viewport;\n oldId: string;\n newId: string;\n}\n\n/** View Id Change event\n * @public\n * @deprecated in 4.13.0. This class should not be used by applications to instantiate objects.\n */\n// eslint-disable-next-line @typescript-eslint/no-deprecated\nexport class ViewIdChangedEvent extends UiEvent<ViewIdChangedEventArgs> {}\n\n/** Viewport Rotation events and methods\n * @public\n */\nexport class ViewportComponentEvents {\n private static _removeListener?: () => void;\n\n public static initialize() {\n if (undefined !== this._removeListener) return;\n\n this._removeListener =\n IModelApp.viewManager.onSelectedViewportChanged.addListener(\n ViewportComponentEvents._handleSelectedViewportChanged\n );\n }\n\n /** @internal - for unit testing */\n public static terminate() {\n if (this._removeListener) {\n this._removeListener();\n this._removeListener = undefined;\n }\n }\n\n public static face = Face.None;\n public static readonly origin = Point3d.createZero();\n public static readonly extents = Vector3d.createZero();\n public static readonly rotationMatrix = Matrix3d.createIdentity();\n public static readonly onDrawingViewportChangeEvent =\n new DrawingViewportChangeEvent(); // eslint-disable-line @typescript-eslint/no-deprecated\n public static readonly onCubeRotationChangeEvent =\n new CubeRotationChangeEvent(); // eslint-disable-line @typescript-eslint/no-deprecated\n public static readonly onStandardRotationChangeEvent =\n new StandardRotationChangeEvent(); // eslint-disable-line @typescript-eslint/no-deprecated\n public static readonly onViewRotationChangeEvent =\n new ViewRotationChangeEvent(); // eslint-disable-line @typescript-eslint/no-deprecated\n public static readonly onViewClassFullNameChangedEvent =\n new ViewClassFullNameChangedEvent(); // eslint-disable-line @typescript-eslint/no-deprecated\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n public static readonly onViewIdChangedEvent = new ViewIdChangedEvent();\n\n private static _handleSelectedViewportChanged: ListenerType<\n typeof IModelApp.viewManager.onSelectedViewportChanged\n > = (args) => {\n if (args.current) ViewportComponentEvents.setViewMatrix(args.current);\n };\n\n public static setCubeMatrix(\n rotMatrix: Matrix3d,\n face = Face.None,\n complete: boolean = false\n ): void {\n this.rotationMatrix.setFrom(rotMatrix);\n this.face = face;\n this.onCubeRotationChangeEvent.emit({ rotMatrix, complete, face });\n }\n\n public static setDrawingViewportState(\n origin: Point3d,\n rotation: Matrix3d,\n complete: boolean = false\n ): void {\n this.onDrawingViewportChangeEvent.emit({ origin, rotation, complete });\n }\n\n public static setStandardRotation(standardRotation: StandardViewId): void {\n this.onStandardRotationChangeEvent.emit({ standardRotation });\n }\n\n public static setViewMatrix(\n viewport: Viewport,\n animationTime?: number\n ): void {\n // When handling onViewChanged, use setTimeout\n setTimeout(() => {\n if (viewport.view) {\n this.origin.setFrom(viewport.view.getOrigin());\n this.extents.setFrom(viewport.view.getExtents());\n }\n this.rotationMatrix.setFrom(viewport.rotation);\n\n this.onViewRotationChangeEvent.emit({ viewport, animationTime });\n });\n }\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itwin/imodel-components-react",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.20.0",
|
|
4
4
|
"description": "A react component library of iTwin.js UI iModel components",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"types": "./lib/imodel-components-react.d.ts",
|
|
@@ -44,12 +44,12 @@
|
|
|
44
44
|
"@itwin/itwinui-react": "^3.15.0",
|
|
45
45
|
"react": "^18.0.0 || ^19.0.0",
|
|
46
46
|
"react-dom": "^18.0.0 || ^19.0.0",
|
|
47
|
-
"@itwin/components-react": "5.
|
|
48
|
-
"@itwin/core-react": "5.
|
|
47
|
+
"@itwin/components-react": "5.20.0",
|
|
48
|
+
"@itwin/core-react": "5.20.0"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@itwin/appui-abstract": "^5.1.0",
|
|
52
|
-
"@itwin/build-tools": "
|
|
52
|
+
"@itwin/build-tools": "^5.3.2",
|
|
53
53
|
"@itwin/core-bentley": "^5.1.0",
|
|
54
54
|
"@itwin/core-common": "^5.1.0",
|
|
55
55
|
"@itwin/core-frontend": "^5.1.0",
|
|
@@ -78,14 +78,14 @@
|
|
|
78
78
|
"react": "^19.2.0",
|
|
79
79
|
"react-dom": "^19.2.0",
|
|
80
80
|
"reflect-metadata": "^0.1.13",
|
|
81
|
-
"rimraf": "^6.0
|
|
81
|
+
"rimraf": "^6.1.0",
|
|
82
82
|
"ts-node": "^10.8.2",
|
|
83
83
|
"typemoq": "^2.1.0",
|
|
84
84
|
"typescript": "~5.6.2",
|
|
85
85
|
"upath": "^2.0.1",
|
|
86
86
|
"vitest": "^3.2.4",
|
|
87
|
-
"@itwin/components-react": "5.
|
|
88
|
-
"@itwin/core-react": "5.
|
|
87
|
+
"@itwin/components-react": "5.20.0",
|
|
88
|
+
"@itwin/core-react": "5.20.0"
|
|
89
89
|
},
|
|
90
90
|
"dependencies": {
|
|
91
91
|
"@itwin/itwinui-icons-react": "^2.8.0",
|