Add existing to tracked

This commit is contained in:
Jay
2026-08-11 09:53:42 -04:00
parent afe07f3055
commit ffd6e3d73c
8531 changed files with 4396230 additions and 0 deletions
@@ -0,0 +1,7 @@
.cesium-button.cesium-fullscreenButton {
display: block;
width: 100%;
height: 100%;
margin: 0;
border-radius: 0;
}
@@ -0,0 +1,108 @@
import {
defined,
destroyObject,
DeveloperError,
getElement,
} from "@cesium/engine";
import knockout from "../ThirdParty/knockout.js";
import FullscreenButtonViewModel from "./FullscreenButtonViewModel.js";
const enterFullScreenPath =
"M 83.96875 17.5625 L 83.96875 17.59375 L 76.65625 24.875 L 97.09375 24.96875 L 76.09375 45.96875 L 81.9375 51.8125 L 102.78125 30.9375 L 102.875 51.15625 L 110.15625 43.875 L 110.1875 17.59375 L 83.96875 17.5625 z M 44.125 17.59375 L 17.90625 17.625 L 17.9375 43.90625 L 25.21875 51.1875 L 25.3125 30.96875 L 46.15625 51.8125 L 52 45.96875 L 31 25 L 51.4375 24.90625 L 44.125 17.59375 z M 46.0625 76.03125 L 25.1875 96.875 L 25.09375 76.65625 L 17.8125 83.9375 L 17.8125 110.21875 L 44 110.25 L 51.3125 102.9375 L 30.90625 102.84375 L 51.875 81.875 L 46.0625 76.03125 z M 82 76.15625 L 76.15625 82 L 97.15625 103 L 76.71875 103.0625 L 84.03125 110.375 L 110.25 110.34375 L 110.21875 84.0625 L 102.9375 76.8125 L 102.84375 97 L 82 76.15625 z";
const exitFullScreenPath =
"M 104.34375 17.5625 L 83.5 38.4375 L 83.40625 18.21875 L 76.125 25.5 L 76.09375 51.78125 L 102.3125 51.8125 L 102.3125 51.78125 L 109.625 44.5 L 89.1875 44.40625 L 110.1875 23.40625 L 104.34375 17.5625 z M 23.75 17.59375 L 17.90625 23.4375 L 38.90625 44.4375 L 18.5 44.53125 L 25.78125 51.8125 L 52 51.78125 L 51.96875 25.53125 L 44.6875 18.25 L 44.625 38.46875 L 23.75 17.59375 z M 25.6875 76.03125 L 18.375 83.3125 L 38.78125 83.40625 L 17.8125 104.40625 L 23.625 110.25 L 44.5 89.375 L 44.59375 109.59375 L 51.875 102.3125 L 51.875 76.0625 L 25.6875 76.03125 z M 102.375 76.15625 L 76.15625 76.1875 L 76.1875 102.4375 L 83.46875 109.71875 L 83.5625 89.53125 L 104.40625 110.375 L 110.25 104.53125 L 89.25 83.53125 L 109.6875 83.46875 L 102.375 76.15625 z";
/**
* A single button widget for toggling fullscreen mode.
*
* @alias FullscreenButton
* @constructor
*
* @param {Element|string} container The DOM element or ID that will contain the widget.
* @param {Element|string} [fullscreenElement=document.body] The element or id to be placed into fullscreen mode.
*
* @exception {DeveloperError} Element with id "container" does not exist in the document.
*
* @see Fullscreen
*/
function FullscreenButton(container, fullscreenElement) {
//>>includeStart('debug', pragmas.debug);
if (!defined(container)) {
throw new DeveloperError("container is required.");
}
//>>includeEnd('debug');
container = getElement(container);
const viewModel = new FullscreenButtonViewModel(fullscreenElement, container);
viewModel._exitFullScreenPath = exitFullScreenPath;
viewModel._enterFullScreenPath = enterFullScreenPath;
const element = document.createElement("button");
element.type = "button";
element.className = "cesium-button cesium-fullscreenButton";
element.setAttribute(
"data-bind",
"\
attr: { title: tooltip },\
click: command,\
enable: isFullscreenEnabled,\
cesiumSvgPath: { path: isFullscreen ? _exitFullScreenPath : _enterFullScreenPath, width: 128, height: 128 }",
);
container.appendChild(element);
knockout.applyBindings(viewModel, element);
this._container = container;
this._viewModel = viewModel;
this._element = element;
}
Object.defineProperties(FullscreenButton.prototype, {
/**
* Gets the parent container.
* @memberof FullscreenButton.prototype
*
* @type {Element}
*/
container: {
get: function () {
return this._container;
},
},
/**
* Gets the view model.
* @memberof FullscreenButton.prototype
*
* @type {FullscreenButtonViewModel}
*/
viewModel: {
get: function () {
return this._viewModel;
},
},
});
/**
* @returns {boolean} true if the object has been destroyed, false otherwise.
*/
FullscreenButton.prototype.isDestroyed = function () {
return false;
};
/**
* Destroys the widget. Should be called if permanently
* removing the widget from layout.
*/
FullscreenButton.prototype.destroy = function () {
this._viewModel.destroy();
knockout.cleanNode(this._element);
this._container.removeChild(this._element);
return destroyObject(this);
};
export default FullscreenButton;
@@ -0,0 +1,144 @@
import {
defined,
destroyObject,
DeveloperError,
Fullscreen,
getElement,
} from "@cesium/engine";
import knockout from "../ThirdParty/knockout.js";
import createCommand from "../createCommand.js";
/**
* The view model for {@link FullscreenButton}.
* @alias FullscreenButtonViewModel
* @constructor
*
* @param {Element|string} [fullscreenElement=document.body] The element or id to be placed into fullscreen mode.
* @param {Element|string} [container] The DOM element or ID that will contain the widget.
*/
function FullscreenButtonViewModel(fullscreenElement, container) {
if (!defined(container)) {
container = document.body;
}
container = getElement(container);
const that = this;
const tmpIsFullscreen = knockout.observable(Fullscreen.fullscreen);
const tmpIsEnabled = knockout.observable(Fullscreen.enabled);
const ownerDocument = container.ownerDocument;
/**
* Gets whether or not fullscreen mode is active. This property is observable.
*
* @type {boolean}
*/
this.isFullscreen = undefined;
knockout.defineProperty(this, "isFullscreen", {
get: function () {
return tmpIsFullscreen();
},
});
/**
* Gets or sets whether or not fullscreen functionality should be enabled. This property is observable.
*
* @type {boolean}
* @see Fullscreen.enabled
*/
this.isFullscreenEnabled = undefined;
knockout.defineProperty(this, "isFullscreenEnabled", {
get: function () {
return tmpIsEnabled();
},
set: function (value) {
tmpIsEnabled(value && Fullscreen.enabled);
},
});
/**
* Gets the tooltip. This property is observable.
*
* @type {string}
*/
this.tooltip = undefined;
knockout.defineProperty(this, "tooltip", function () {
if (!this.isFullscreenEnabled) {
return "Full screen unavailable";
}
return tmpIsFullscreen() ? "Exit full screen" : "Full screen";
});
this._command = createCommand(
function () {
if (Fullscreen.fullscreen) {
Fullscreen.exitFullscreen();
} else {
Fullscreen.requestFullscreen(that._fullscreenElement);
}
},
knockout.getObservable(this, "isFullscreenEnabled"),
);
this._fullscreenElement = getElement(fullscreenElement) ?? ownerDocument.body;
this._callback = function () {
tmpIsFullscreen(Fullscreen.fullscreen);
};
ownerDocument.addEventListener(Fullscreen.changeEventName, this._callback);
}
Object.defineProperties(FullscreenButtonViewModel.prototype, {
/**
* Gets or sets the HTML element to place into fullscreen mode when the
* corresponding button is pressed.
* @memberof FullscreenButtonViewModel.prototype
*
* @type {Element}
*/
fullscreenElement: {
//TODO:@exception {DeveloperError} value must be a valid HTML Element.
get: function () {
return this._fullscreenElement;
},
set: function (value) {
//>>includeStart('debug', pragmas.debug);
if (!(value instanceof Element)) {
throw new DeveloperError("value must be a valid Element.");
}
//>>includeEnd('debug');
this._fullscreenElement = value;
},
},
/**
* Gets the Command to toggle fullscreen mode.
* @memberof FullscreenButtonViewModel.prototype
*
* @type {Command}
*/
command: {
get: function () {
return this._command;
},
},
});
/**
* @returns {boolean} true if the object has been destroyed, false otherwise.
*/
FullscreenButtonViewModel.prototype.isDestroyed = function () {
return false;
};
/**
* Destroys the view model. Should be called to
* properly clean up the view model when it is no longer needed.
*/
FullscreenButtonViewModel.prototype.destroy = function () {
document.removeEventListener(Fullscreen.changeEventName, this._callback);
destroyObject(this);
};
export default FullscreenButtonViewModel;