123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114 |
- import defined from "../../Core/defined.js";
- import destroyObject from "../../Core/destroyObject.js";
- import DeveloperError from "../../Core/DeveloperError.js";
- import knockout from "../../ThirdParty/knockout.js";
- import getElement from "../getElement.js";
- import SelectionIndicatorViewModel from "./SelectionIndicatorViewModel.js";
- function SelectionIndicator(container, scene) {
-
- if (!defined(container)) {
- throw new DeveloperError("container is required.");
- }
-
- container = getElement(container);
- this._container = container;
- var 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;
- var svgNS = "http://www.w3.org/2000/svg";
- var 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";
- var svg = document.createElementNS(svgNS, "svg:svg");
- svg.setAttribute("width", 160);
- svg.setAttribute("height", 160);
- svg.setAttribute("viewBox", "0 0 160 160");
- var group = document.createElementNS(svgNS, "g");
- group.setAttribute("transform", "translate(80,80)");
- svg.appendChild(group);
- var pathElement = document.createElementNS(svgNS, "path");
- pathElement.setAttribute("data-bind", "attr: { transform: _transform }");
- pathElement.setAttribute("d", path);
- group.appendChild(pathElement);
- el.appendChild(svg);
- var viewModel = new SelectionIndicatorViewModel(
- scene,
- this._element,
- this._container
- );
- this._viewModel = viewModel;
- knockout.applyBindings(this._viewModel, this._element);
- }
- Object.defineProperties(SelectionIndicator.prototype, {
-
- container: {
- get: function () {
- return this._container;
- },
- },
-
- viewModel: {
- get: function () {
- return this._viewModel;
- },
- },
- });
- SelectionIndicator.prototype.isDestroyed = function () {
- return false;
- };
- SelectionIndicator.prototype.destroy = function () {
- var container = this._container;
- knockout.cleanNode(this._element);
- container.removeChild(this._element);
- return destroyObject(this);
- };
- export default SelectionIndicator;
|