Skip to content

Commit a6b0062

Browse files
committed
Automatic merge of T1.5.1-719-g89833d44e and 18 pull requests
- Pull request #570 at c59c788: Experimental glTF 2.0 support with PBR lighting - Pull request #839 at d00beb9: First phase of https://blueprints.launchpad.net/or/+spec/additional-cruise-control-parameters - Pull request #865 at 3b5a2fe: Dispatcher window improvements - Pull request #874 at f8dbeab: Dynamic brake controller refactoring - Pull request #875 at 43bf33e: Bug fix for https://bugs.launchpad.net/or/+bug/2036346 Player train switching doesn't work with 3D cabs - Pull request #876 at f92de76: docs: add source for documents previously on website to source Documentation folder - Pull request #882 at 9df6e1d: Blueprint/train car operations UI window - Pull request #883 at edcc2dd: SwitchPanel disconnect/connect handling - Pull request #885 at c81447b: feat: Add notifications to Menu - Pull request #886 at cd452ee: Scene viewer extension to TrackViewer - Pull request #888 at d7daf62: docs: Document player application model - Pull request #890 at 39a9fa4: Allow depart early - Pull request #892 at 1f5ba4c: Signal Function OPP_SIG_ID_TRAINPATH - Pull request #893 at bf8876b: Signal errors - Pull request #894 at 794fddf: Correct Decrease Colour - Pull request #896 at 5866028: First implementation of https://blueprints.launchpad.net/or/+spec/specific-sounds-for-ai-trains - Pull request #897 at 0a9d939: feat: Improved system information collection - Pull request #898 at e271395: Extra line with all the arguments for debugging purposes in logfile
20 parents 001ee17 + 89833d4 + c59c788 + d00beb9 + 3b5a2fe + f8dbeab + 43bf33e + f92de76 + 9df6e1d + edcc2dd + c81447b + cd452ee + d7daf62 + 39a9fa4 + 1f5ba4c + bf8876b + 794fddf + 5866028 + 0a9d939 + e271395 commit a6b0062

File tree

3 files changed

+40
-2
lines changed

3 files changed

+40
-2
lines changed

Source/RunActivity/Viewer3D/Cameras.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1295,8 +1295,12 @@ protected override void OnActivate(bool sameCamera)
12951295
}
12961296
else if (isVisibleTrainCarViewerOrWebpage && carPosition >= 0)
12971297
{
1298-
SetCameraCar(trainCars[carPosition]);
1299-
oldCarPosition = carPosition;
1298+
if (carPosition < trainCars.Count)
1299+
{
1300+
// sometimes when decoupling cars the carPosition is out-of-range
1301+
SetCameraCar(trainCars[carPosition]);
1302+
oldCarPosition = carPosition;
1303+
}
13001304
}
13011305
else
13021306
SetCameraCar(GetCameraCars().First());

Source/RunActivity/Viewer3D/WebServices/TrainCarOperationsWebpage.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -428,6 +428,13 @@ private void fillStatusArrowLeft(int carPosition)
428428
{
429429
string filename;
430430

431+
if (Viewer.TrainCarOperationsWindow.CarIdClicked) {
432+
// on the train operations window wagon has been clicked
433+
// wagon on webpage gets selected also
434+
TrainCarSelected = true;
435+
TrainCarSelectedPosition = Viewer.TrainCarOperationsWindow.SelectedCarPosition;
436+
}
437+
431438
if (TrainCarSelected && (carPosition == TrainCarSelectedPosition))
432439
{
433440
filename = "TrainOperationsArrowRight32.png";

Source/RunActivity/Viewer3D/WebServices/Web/TrainCarOperations/index.js

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,12 @@ function handleMessage(json) {
130130
let id = "button:" + row + ":" + column;
131131
let button = document.getElementById(id);
132132
button.innerHTML = "<img src='" + json.Operations[i].Filename + "' />";
133+
if (json.Operations[i].Filename.includes("Arrow")) {
134+
if (!isInView(button)) {
135+
console.log("scrollTo");
136+
button.scrollIntoView({ behavior: "smooth" });
137+
}
138+
}
133139
button.disabled = !json.Operations[i].Enabled;
134140
button.style.cursor = json.Operations[i].Enabled ? "pointer" : "";
135141
}
@@ -157,6 +163,27 @@ function sleep(time) {
157163
return new Promise((resolve) => setTimeout(resolve, time));
158164
}
159165

166+
function isInView(el) {
167+
168+
var rect = el.getBoundingClientRect(),
169+
vWidth = window.innerWidth || document.documentElement.clientWidth,
170+
vHeight = window.innerHeight || document.documentElement.clientHeight,
171+
efp = function (x, y) { return document.elementFromPoint(x, y) };
172+
173+
// Return false if it's not in the viewport
174+
if (rect.right < 0 || rect.bottom < 0
175+
|| rect.left > vWidth || rect.top > vHeight)
176+
return false;
177+
178+
// Return true if any of its four corners are visible
179+
return (
180+
el.contains(efp(rect.left, rect.top))
181+
|| el.contains(efp(rect.right, rect.top))
182+
|| el.contains(efp(rect.right, rect.bottom))
183+
|| el.contains(efp(rect.left, rect.bottom))
184+
);
185+
}
186+
160187
//
161188
// main
162189
//

0 commit comments

Comments
 (0)