bruce-cesium 5.5.3 → 5.5.4
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/dist/bruce-cesium.es5.js +323 -4
- package/dist/bruce-cesium.es5.js.map +1 -1
- package/dist/bruce-cesium.umd.js +322 -3
- package/dist/bruce-cesium.umd.js.map +1 -1
- package/dist/lib/bruce-cesium.js +1 -1
- package/dist/lib/rendering/render-managers/common/entity-label.js +6 -2
- package/dist/lib/rendering/render-managers/common/entity-label.js.map +1 -1
- package/dist/lib/widgets/tabs-left-panel/widget-left-panel-tab-user.js +304 -0
- package/dist/lib/widgets/tabs-left-panel/widget-left-panel-tab-user.js.map +1 -0
- package/dist/lib/widgets/widget-left-panel.js +18 -0
- package/dist/lib/widgets/widget-left-panel.js.map +1 -1
- package/dist/types/bruce-cesium.d.ts +1 -1
- package/dist/types/widgets/tabs-left-panel/widget-left-panel-tab-user.d.ts +24 -0
- package/package.json +2 -2
package/dist/bruce-cesium.umd.js
CHANGED
|
@@ -9713,7 +9713,9 @@
|
|
|
9713
9713
|
lineEle.style.display = "none";
|
|
9714
9714
|
return;
|
|
9715
9715
|
}
|
|
9716
|
-
const
|
|
9716
|
+
const CESIUM = Cesium;
|
|
9717
|
+
const _3dTo2D = Cesium.SceneTransforms.hasOwnProperty("wgs84ToWindowCoordinates") ? CESIUM.SceneTransforms.wgs84ToWindowCoordinates : CESIUM.SceneTransforms.worldToWindowCoordinates;
|
|
9718
|
+
const lineStartPos2d = _3dTo2D(this.viewer.scene, this._pos3d);
|
|
9717
9719
|
// Invalid point.
|
|
9718
9720
|
if (isNaN(lineStartPos2d === null || lineStartPos2d === void 0 ? void 0 : lineStartPos2d.x)) {
|
|
9719
9721
|
ele.style.transform = "";
|
|
@@ -9767,7 +9769,9 @@
|
|
|
9767
9769
|
}
|
|
9768
9770
|
lineEndPoint.height += addHeight;
|
|
9769
9771
|
lineEndPos3d = Cesium.Cartographic.toCartesian(lineEndPoint);
|
|
9770
|
-
|
|
9772
|
+
const CESIUM = Cesium;
|
|
9773
|
+
const _3dTo2D = Cesium.SceneTransforms.hasOwnProperty("wgs84ToWindowCoordinates") ? CESIUM.SceneTransforms.wgs84ToWindowCoordinates : CESIUM.SceneTransforms.worldToWindowCoordinates;
|
|
9774
|
+
let lineEndPos2d = _3dTo2D(this.viewer.scene, lineEndPos3d);
|
|
9771
9775
|
// Invalid point.
|
|
9772
9776
|
if (isNaN(lineEndPos2d === null || lineEndPos2d === void 0 ? void 0 : lineEndPos2d.x)) {
|
|
9773
9777
|
ele.style.transform = "";
|
|
@@ -25389,6 +25393,304 @@
|
|
|
25389
25393
|
ViewRenderEngine.FlyTo = FlyTo;
|
|
25390
25394
|
})(exports.ViewRenderEngine || (exports.ViewRenderEngine = {}));
|
|
25391
25395
|
|
|
25396
|
+
class WidgetLeftPanelTabUser extends exports.WidgetLeftPanelTab.ATab {
|
|
25397
|
+
constructor(params) {
|
|
25398
|
+
super(params);
|
|
25399
|
+
this.STYLESHEET_ID = "nextspace-left-panel-tab-user-stylesheet";
|
|
25400
|
+
this.loadedSessionId = null;
|
|
25401
|
+
this.user = null;
|
|
25402
|
+
this.loaded = false;
|
|
25403
|
+
this.loggingOut = false;
|
|
25404
|
+
this.loggingIn = false;
|
|
25405
|
+
this.inputUsername = null;
|
|
25406
|
+
this.inputPassword = null;
|
|
25407
|
+
this._generateStyles();
|
|
25408
|
+
this._generateElement();
|
|
25409
|
+
// In case another widget messed with the panel width.
|
|
25410
|
+
// Probably should just add a SetWidth method to avoid having plugins mess with the container CSS.
|
|
25411
|
+
if (this.Container) {
|
|
25412
|
+
this.Container.style.width = "300px";
|
|
25413
|
+
}
|
|
25414
|
+
this.loadUser();
|
|
25415
|
+
this.paramsChangeRemoval = BModels.ENVIRONMENT.OnParamsChange.Subscribe(() => {
|
|
25416
|
+
this.loadUser();
|
|
25417
|
+
});
|
|
25418
|
+
}
|
|
25419
|
+
async loadUser() {
|
|
25420
|
+
if (this.loadedSessionId === BModels.ENVIRONMENT.PARAMS.sessionId) {
|
|
25421
|
+
return;
|
|
25422
|
+
}
|
|
25423
|
+
let loadingSessionId = BModels.ENVIRONMENT.PARAMS.sessionId;
|
|
25424
|
+
try {
|
|
25425
|
+
this.user = null;
|
|
25426
|
+
if (BModels.ENVIRONMENT.PARAMS.sessionId && BModels.ENVIRONMENT.PARAMS.sessionId !== "anonymous") {
|
|
25427
|
+
const { session } = await BModels.Session.Get({
|
|
25428
|
+
accountId: BModels.ENVIRONMENT.PARAMS.accountId,
|
|
25429
|
+
sessionId: loadingSessionId
|
|
25430
|
+
});
|
|
25431
|
+
if (loadingSessionId !== BModels.ENVIRONMENT.PARAMS.sessionId) {
|
|
25432
|
+
return;
|
|
25433
|
+
}
|
|
25434
|
+
this.user = session === null || session === void 0 ? void 0 : session.User;
|
|
25435
|
+
}
|
|
25436
|
+
}
|
|
25437
|
+
catch (e) {
|
|
25438
|
+
console.error(e);
|
|
25439
|
+
}
|
|
25440
|
+
finally {
|
|
25441
|
+
if (loadingSessionId === BModels.ENVIRONMENT.PARAMS.sessionId) {
|
|
25442
|
+
this.loaded = true;
|
|
25443
|
+
this._generateElement();
|
|
25444
|
+
}
|
|
25445
|
+
}
|
|
25446
|
+
}
|
|
25447
|
+
/**
|
|
25448
|
+
* Returns if the user can logout.
|
|
25449
|
+
* If the session is part of URL, we don't want to show the logout button.
|
|
25450
|
+
* @returns {boolean}
|
|
25451
|
+
*/
|
|
25452
|
+
canLogout() {
|
|
25453
|
+
if (!this.user || this.user.ID === "anonymous") {
|
|
25454
|
+
return false;
|
|
25455
|
+
}
|
|
25456
|
+
const url = new URL(window.location.href);
|
|
25457
|
+
let sessionId = url.searchParams.get("sessionId");
|
|
25458
|
+
if (!sessionId) {
|
|
25459
|
+
sessionId = url.searchParams.get("ssid");
|
|
25460
|
+
}
|
|
25461
|
+
if (sessionId) {
|
|
25462
|
+
return false;
|
|
25463
|
+
}
|
|
25464
|
+
return true;
|
|
25465
|
+
}
|
|
25466
|
+
async logout() {
|
|
25467
|
+
if (this.loggingOut) {
|
|
25468
|
+
return;
|
|
25469
|
+
}
|
|
25470
|
+
else if (!this.canLogout()) {
|
|
25471
|
+
return;
|
|
25472
|
+
}
|
|
25473
|
+
try {
|
|
25474
|
+
await BModels.Session.Logout({});
|
|
25475
|
+
BModels.ENVIRONMENT.SetPageLoadSessionId(null);
|
|
25476
|
+
}
|
|
25477
|
+
catch (e) {
|
|
25478
|
+
console.error(e);
|
|
25479
|
+
}
|
|
25480
|
+
window.location.reload();
|
|
25481
|
+
}
|
|
25482
|
+
Dispose() {
|
|
25483
|
+
super.Dispose();
|
|
25484
|
+
if (this.paramsChangeRemoval) {
|
|
25485
|
+
this.paramsChangeRemoval();
|
|
25486
|
+
this.paramsChangeRemoval = null;
|
|
25487
|
+
}
|
|
25488
|
+
}
|
|
25489
|
+
_generateStyles() {
|
|
25490
|
+
if (document.getElementById(this.STYLESHEET_ID)) {
|
|
25491
|
+
return;
|
|
25492
|
+
}
|
|
25493
|
+
const style = document.createElement("style");
|
|
25494
|
+
style.id = this.STYLESHEET_ID;
|
|
25495
|
+
style.innerHTML = `
|
|
25496
|
+
.NextspaceLeftPanelTabUser * {
|
|
25497
|
+
box-sizing: border-box;
|
|
25498
|
+
font-family: Arial;
|
|
25499
|
+
font-size: 13px;
|
|
25500
|
+
}
|
|
25501
|
+
|
|
25502
|
+
.NextspaceLeftPanelTabUser {
|
|
25503
|
+
display: flex;
|
|
25504
|
+
flex-direction: column;
|
|
25505
|
+
flex-grow: 1;
|
|
25506
|
+
flex-shrink: 1;
|
|
25507
|
+
overflow: hidden;
|
|
25508
|
+
width: 100%;
|
|
25509
|
+
box-sizing: border-box;
|
|
25510
|
+
}
|
|
25511
|
+
|
|
25512
|
+
.NextspaceLeftPanelTabUser >.NextspaceLeftPanelTabUserTitleBar {
|
|
25513
|
+
align-items: center;
|
|
25514
|
+
color: #fff;
|
|
25515
|
+
display: flex;
|
|
25516
|
+
font-size: 17px;
|
|
25517
|
+
font-style: normal;
|
|
25518
|
+
font-weight: 500;
|
|
25519
|
+
justify-content: center;
|
|
25520
|
+
letter-spacing: -.005em;
|
|
25521
|
+
line-height: 20px;
|
|
25522
|
+
margin-bottom: 15px;
|
|
25523
|
+
font-family: Arial;
|
|
25524
|
+
}
|
|
25525
|
+
|
|
25526
|
+
.NextspaceLeftPanelTabUser >.NextspaceLeftPanelTabUserTitleBreaker {
|
|
25527
|
+
background-color: #000;
|
|
25528
|
+
flex-shrink: 0;
|
|
25529
|
+
height: 2px;
|
|
25530
|
+
margin-bottom: 15px;
|
|
25531
|
+
}
|
|
25532
|
+
|
|
25533
|
+
.NextspaceLeftPanelTabUser >.NextspaceLeftPanelTabUserInputRow {
|
|
25534
|
+
display: flex;
|
|
25535
|
+
flex-direction: row;
|
|
25536
|
+
align-items: center;
|
|
25537
|
+
margin-bottom: 8px;
|
|
25538
|
+
width: 100%;
|
|
25539
|
+
}
|
|
25540
|
+
|
|
25541
|
+
.NextspaceLeftPanelTabUser >.NextspaceLeftPanelTabUserInputRow >label {
|
|
25542
|
+
width: 90px;
|
|
25543
|
+
flex-shrink: 0;
|
|
25544
|
+
margin-right: 8px;
|
|
25545
|
+
color: white;
|
|
25546
|
+
}
|
|
25547
|
+
|
|
25548
|
+
.NextspaceLeftPanelTabUser >.NextspaceLeftPanelTabUserInputRow >input {
|
|
25549
|
+
flex-grow: 1;
|
|
25550
|
+
max-width: 220px;
|
|
25551
|
+
|
|
25552
|
+
background-color: #121619;
|
|
25553
|
+
border: 1px solid #ffffff36;
|
|
25554
|
+
color: #fff;
|
|
25555
|
+
flex-grow: 1;
|
|
25556
|
+
flex-shrink: 1;
|
|
25557
|
+
height: 30px;
|
|
25558
|
+
text-align: left;
|
|
25559
|
+
border-radius: .375rem;
|
|
25560
|
+
outline: none;
|
|
25561
|
+
padding: .5rem .75rem;
|
|
25562
|
+
box-sizing: border-box;
|
|
25563
|
+
width: 10px;
|
|
25564
|
+
}
|
|
25565
|
+
|
|
25566
|
+
.NextspaceLeftPanelTabUser button {
|
|
25567
|
+
cursor: pointer;
|
|
25568
|
+
border-radius: .375rem;
|
|
25569
|
+
padding: 4px 9px;
|
|
25570
|
+
transition: opacity 0.3s ease;
|
|
25571
|
+
width: 100px;
|
|
25572
|
+
width: min-content;
|
|
25573
|
+
height: min-content;
|
|
25574
|
+
white-space: nowrap;
|
|
25575
|
+
border: 1px solid grey;
|
|
25576
|
+
color: black;
|
|
25577
|
+
background-color: white;
|
|
25578
|
+
display: flex;
|
|
25579
|
+
align-items: center;
|
|
25580
|
+
justify-content: center;
|
|
25581
|
+
position: relative;
|
|
25582
|
+
background-color: #0072c3;
|
|
25583
|
+
border: 1px solid #0072c3;
|
|
25584
|
+
color: white;
|
|
25585
|
+
|
|
25586
|
+
margin-left: auto;
|
|
25587
|
+
}
|
|
25588
|
+
`;
|
|
25589
|
+
document.head.appendChild(style);
|
|
25590
|
+
}
|
|
25591
|
+
_generateElement() {
|
|
25592
|
+
var _a, _b;
|
|
25593
|
+
if ((_a = this._element) === null || _a === void 0 ? void 0 : _a.parentElement) {
|
|
25594
|
+
this._element.parentElement.removeChild(this._element);
|
|
25595
|
+
}
|
|
25596
|
+
this._element = null;
|
|
25597
|
+
const element = document.createElement("div");
|
|
25598
|
+
element.className = "NextspaceLeftPanelTabUser";
|
|
25599
|
+
const title = document.createElement("div");
|
|
25600
|
+
title.className = "NextspaceLeftPanelTabUserTitleBar";
|
|
25601
|
+
title.textContent = this.loaded ? (this.user ? ((_b = this.user.FullName) !== null && _b !== void 0 ? _b : "#" + this.user.ID) : "Guest") : "Loading..";
|
|
25602
|
+
element.appendChild(title);
|
|
25603
|
+
const breaker = document.createElement("div");
|
|
25604
|
+
breaker.className = "NextspaceLeftPanelTabUserTitleBreaker";
|
|
25605
|
+
element.appendChild(breaker);
|
|
25606
|
+
if (!this.user || this.user.ID === "anonymous") {
|
|
25607
|
+
{
|
|
25608
|
+
const inputRow = document.createElement("div");
|
|
25609
|
+
inputRow.className = "NextspaceLeftPanelTabUserInputRow";
|
|
25610
|
+
const label = document.createElement("label");
|
|
25611
|
+
label.textContent = "Username";
|
|
25612
|
+
inputRow.appendChild(label);
|
|
25613
|
+
const input = document.createElement("input");
|
|
25614
|
+
input.type = "text";
|
|
25615
|
+
input.placeholder = "...";
|
|
25616
|
+
this.inputUsername = input;
|
|
25617
|
+
inputRow.appendChild(this.inputUsername);
|
|
25618
|
+
element.appendChild(inputRow);
|
|
25619
|
+
}
|
|
25620
|
+
{
|
|
25621
|
+
const inputRow = document.createElement("div");
|
|
25622
|
+
inputRow.className = "NextspaceLeftPanelTabUserInputRow";
|
|
25623
|
+
const label = document.createElement("label");
|
|
25624
|
+
label.textContent = "Password";
|
|
25625
|
+
inputRow.appendChild(label);
|
|
25626
|
+
const input = document.createElement("input");
|
|
25627
|
+
input.type = "password";
|
|
25628
|
+
input.placeholder = "...";
|
|
25629
|
+
this.inputPassword = input;
|
|
25630
|
+
inputRow.appendChild(this.inputPassword);
|
|
25631
|
+
element.appendChild(inputRow);
|
|
25632
|
+
}
|
|
25633
|
+
{
|
|
25634
|
+
const button = document.createElement("button");
|
|
25635
|
+
button.textContent = "Login";
|
|
25636
|
+
button.onclick = async () => {
|
|
25637
|
+
var _a, _b, _c, _d, _e, _f;
|
|
25638
|
+
if (this.loggingIn) {
|
|
25639
|
+
return;
|
|
25640
|
+
}
|
|
25641
|
+
button.style.opacity = "0.7";
|
|
25642
|
+
this.loggingIn = true;
|
|
25643
|
+
try {
|
|
25644
|
+
const { session } = await BModels.Session.Login({
|
|
25645
|
+
accountId: BModels.ENVIRONMENT.PARAMS.accountId,
|
|
25646
|
+
username: (_b = (_a = this.inputUsername) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : "",
|
|
25647
|
+
password: (_d = (_c = this.inputPassword) === null || _c === void 0 ? void 0 : _c.value) !== null && _d !== void 0 ? _d : ""
|
|
25648
|
+
});
|
|
25649
|
+
BModels.ENVIRONMENT.SetPageLoadSessionId((_e = session === null || session === void 0 ? void 0 : session.ID) !== null && _e !== void 0 ? _e : null);
|
|
25650
|
+
BModels.ENVIRONMENT.Reset({
|
|
25651
|
+
accountId: BModels.ENVIRONMENT.PARAMS.accountId,
|
|
25652
|
+
sessionId: (_f = (session === null || session === void 0 ? void 0 : session.ID)) !== null && _f !== void 0 ? _f : null,
|
|
25653
|
+
});
|
|
25654
|
+
window.location.reload();
|
|
25655
|
+
}
|
|
25656
|
+
catch (e) {
|
|
25657
|
+
console.error(e);
|
|
25658
|
+
}
|
|
25659
|
+
finally {
|
|
25660
|
+
this.loggingIn = false;
|
|
25661
|
+
button.style.opacity = "1";
|
|
25662
|
+
}
|
|
25663
|
+
};
|
|
25664
|
+
element.appendChild(button);
|
|
25665
|
+
}
|
|
25666
|
+
}
|
|
25667
|
+
else {
|
|
25668
|
+
if (this.canLogout()) {
|
|
25669
|
+
const button = document.createElement("button");
|
|
25670
|
+
button.textContent = "Logout";
|
|
25671
|
+
button.onclick = async () => {
|
|
25672
|
+
if (this.loggingOut) {
|
|
25673
|
+
return;
|
|
25674
|
+
}
|
|
25675
|
+
button.style.opacity = "0.7";
|
|
25676
|
+
try {
|
|
25677
|
+
this.logout();
|
|
25678
|
+
}
|
|
25679
|
+
catch (e) {
|
|
25680
|
+
console.error(e);
|
|
25681
|
+
}
|
|
25682
|
+
finally {
|
|
25683
|
+
button.style.opacity = "1";
|
|
25684
|
+
}
|
|
25685
|
+
};
|
|
25686
|
+
element.appendChild(button);
|
|
25687
|
+
}
|
|
25688
|
+
}
|
|
25689
|
+
this.Container.appendChild(element);
|
|
25690
|
+
this._element = element;
|
|
25691
|
+
}
|
|
25692
|
+
}
|
|
25693
|
+
|
|
25392
25694
|
const VIEWER_LEFT_PANEL_WIDGET_KEY = "_viewerLeftPanelWidget";
|
|
25393
25695
|
const VIEWER_LEFT_PANEL_CSS_VAR_LEFT = "--nextspace-left-panel-width";
|
|
25394
25696
|
class WidgetLeftPanel extends exports.Widget.AWidget {
|
|
@@ -25757,6 +26059,7 @@
|
|
|
25757
26059
|
</svg>
|
|
25758
26060
|
`;
|
|
25759
26061
|
buttonBookmarksIcon.innerHTML = LOGGED_OUT_ICON;
|
|
26062
|
+
buttonBookmarksIcon.style.cursor = "pointer";
|
|
25760
26063
|
tabButton.appendChild(buttonBookmarksIcon);
|
|
25761
26064
|
this._element.appendChild(tabButton);
|
|
25762
26065
|
function getInitials(name) {
|
|
@@ -25814,6 +26117,16 @@
|
|
|
25814
26117
|
buttonBookmarksIcon.innerHTML = LOGGED_OUT_ICON;
|
|
25815
26118
|
}
|
|
25816
26119
|
}
|
|
26120
|
+
buttonBookmarksIcon.onclick = () => {
|
|
26121
|
+
if (this._enabledPanelTab === "user") {
|
|
26122
|
+
this._enabledPanelTab = "";
|
|
26123
|
+
}
|
|
26124
|
+
else {
|
|
26125
|
+
this._enabledPanelTab = "user";
|
|
26126
|
+
}
|
|
26127
|
+
this._updatePanelContent();
|
|
26128
|
+
this._updatePanelStyles();
|
|
26129
|
+
};
|
|
25817
26130
|
if (this.envSubRemoval) {
|
|
25818
26131
|
this.envSubRemoval();
|
|
25819
26132
|
this.envSubRemoval = null;
|
|
@@ -25863,6 +26176,12 @@
|
|
|
25863
26176
|
container: container
|
|
25864
26177
|
});
|
|
25865
26178
|
break;
|
|
26179
|
+
case "user":
|
|
26180
|
+
tabContent = new WidgetLeftPanelTabUser({
|
|
26181
|
+
widget: this,
|
|
26182
|
+
container: container
|
|
26183
|
+
});
|
|
26184
|
+
break;
|
|
25866
26185
|
default:
|
|
25867
26186
|
if (this.customTabs.has(this._enabledPanelTab) === false) {
|
|
25868
26187
|
console.error(`Tab ${this._enabledPanelTab} not found.`);
|
|
@@ -30802,7 +31121,7 @@
|
|
|
30802
31121
|
}
|
|
30803
31122
|
}
|
|
30804
31123
|
|
|
30805
|
-
const VERSION = "5.5.
|
|
31124
|
+
const VERSION = "5.5.4";
|
|
30806
31125
|
|
|
30807
31126
|
exports.VERSION = VERSION;
|
|
30808
31127
|
exports.isHistoricMetadataChanged = isHistoricMetadataChanged;
|