Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 | 79x 1x 78x 77x 77x 77x 77x 77x 77x 77x 77x 77x 77x 77x 77x 77x 77x 77x 77x 77x 77x 77x 77x 77x 77x 77x 1x 77x 29x 1x 1x 1x 77x 77x 77x 77x | import {
defined,
destroyObject,
DeveloperError,
getElement,
} from "@cesium/engine";
import knockout from "../ThirdParty/knockout.js";
import SelectionIndicatorViewModel from "./SelectionIndicatorViewModel.js";
/**
* A widget for displaying an indicator on a selected object.
*
* @alias SelectionIndicator
* @constructor
*
* @param {Element|string} container The DOM element or ID that will contain the widget.
* @param {Scene} scene The Scene instance to use.
*
* @exception {DeveloperError} Element with id "container" does not exist in the document.
*/
function SelectionIndicator(container, scene) {
//>>includeStart('debug', pragmas.debug);
if (!defined(container)) {
throw new DeveloperError("container is required.");
}
//>>includeEnd('debug');
container = getElement(container);
this._container = container;
const el = document.createElement("div");
el.className = "cesium-selection-wrapper";
el.setAttribute(
"data-bind",
'\
style: { "top" : _screenPositionY, "left" : _screenPositionX },\
css: { "cesium-selection-wrapper-visible" : isVisible }',
);
container.appendChild(el);
this._element = el;
const svgNS = "http://www.w3.org/2000/svg";
const path =
"M -34 -34 L -34 -11.25 L -30 -15.25 L -30 -30 L -15.25 -30 L -11.25 -34 L -34 -34 z M 11.25 -34 L 15.25 -30 L 30 -30 L 30 -15.25 L 34 -11.25 L 34 -34 L 11.25 -34 z M -34 11.25 L -34 34 L -11.25 34 L -15.25 30 L -30 30 L -30 15.25 L -34 11.25 z M 34 11.25 L 30 15.25 L 30 30 L 15.25 30 L 11.25 34 L 34 34 L 34 11.25 z";
const svg = document.createElementNS(svgNS, "svg:svg");
svg.setAttribute("width", 160);
svg.setAttribute("height", 160);
svg.setAttribute("viewBox", "0 0 160 160");
const group = document.createElementNS(svgNS, "g");
group.setAttribute("transform", "translate(80,80)");
svg.appendChild(group);
const pathElement = document.createElementNS(svgNS, "path");
pathElement.setAttribute("data-bind", "attr: { transform: _transform }");
pathElement.setAttribute("d", path);
group.appendChild(pathElement);
el.appendChild(svg);
const viewModel = new SelectionIndicatorViewModel(
scene,
this._element,
this._container,
);
this._viewModel = viewModel;
knockout.applyBindings(this._viewModel, this._element);
}
Object.defineProperties(SelectionIndicator.prototype, {
/**
* Gets the parent container.
* @memberof SelectionIndicator.prototype
*
* @type {Element}
*/
container: {
get: function () {
return this._container;
},
},
/**
* Gets the view model.
* @memberof SelectionIndicator.prototype
*
* @type {SelectionIndicatorViewModel}
*/
viewModel: {
get: function () {
return this._viewModel;
},
},
});
/**
* @returns {boolean} true if the object has been destroyed, false otherwise.
*/
SelectionIndicator.prototype.isDestroyed = function () {
return false;
};
/**
* Destroys the widget. Should be called if permanently
* removing the widget from layout.
*/
SelectionIndicator.prototype.destroy = function () {
const container = this._container;
knockout.cleanNode(this._element);
container.removeChild(this._element);
return destroyObject(this);
};
export default SelectionIndicator;
|