deeptwins-engine-3d 0.1.18 → 0.1.19

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.
@@ -1,4 +1,5 @@
1
1
  export default class BaseEntity {
2
+ private readonly _mapContext;
2
3
  id: any;
3
4
  source: any;
4
5
  style: any;
@@ -7,5 +8,6 @@ export default class BaseEntity {
7
8
  type: string;
8
9
  isEntity: boolean;
9
10
  constructor(options: any);
11
+ getMap(): any;
10
12
  updateStyle(originStyle: any, style: any): void;
11
13
  }
@@ -7,11 +7,11 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
7
7
  function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
8
8
  import { merge } from 'lodash';
9
9
  import { v4 as uuidv4 } from 'uuid';
10
-
11
10
  // 基础实体图层
12
11
  var BaseEntity = /*#__PURE__*/function () {
13
12
  function BaseEntity(options) {
14
13
  _classCallCheck(this, BaseEntity);
14
+ _defineProperty(this, "_mapContext", void 0);
15
15
  _defineProperty(this, "id", void 0);
16
16
  _defineProperty(this, "source", void 0);
17
17
  _defineProperty(this, "style", void 0);
@@ -22,15 +22,22 @@ var BaseEntity = /*#__PURE__*/function () {
22
22
  this.id = uuidv4();
23
23
  var style = options.style,
24
24
  source = options.source,
25
- positionProperty = options.positionProperty;
25
+ positionProperty = options.positionProperty,
26
+ map = options.map;
27
+ this._mapContext = map._mapContext;
26
28
  this.type = options.type;
27
29
  this.positionProperty = positionProperty;
28
30
  this.source = source;
29
31
  this.style = style || {};
30
32
  }
31
-
32
- // 更新样式
33
33
  _createClass(BaseEntity, [{
34
+ key: "getMap",
35
+ value: function getMap() {
36
+ return this._mapContext && this._mapContext.getMap();
37
+ }
38
+
39
+ // 更新样式
40
+ }, {
34
41
  key: "updateStyle",
35
42
  value: function updateStyle(originStyle, style) {
36
43
  this.style = merge(this.style, originStyle);
@@ -79,7 +79,7 @@ var HtmlEntity = /*#__PURE__*/function (_BaseEntity) {
79
79
  _createClass(HtmlEntity, [{
80
80
  key: "_init",
81
81
  value: function _init(options) {
82
- var _document$getElementB;
82
+ var _this$getMap;
83
83
  var html = options.html,
84
84
  style = options.style;
85
85
  this.container = document.createElement('div');
@@ -91,7 +91,7 @@ var HtmlEntity = /*#__PURE__*/function (_BaseEntity) {
91
91
  this.container.style.cssText = 'position: absolute; left: 0; top: 0; pointer-events: auto;';
92
92
  this._setStyle(style);
93
93
  this.container.style.transform = 'translate3d(10000px, 10000px, 0)';
94
- (_document$getElementB = document.getElementById(HTML_CONTAINER_ID)) === null || _document$getElementB === void 0 || _document$getElementB.appendChild(this.container);
94
+ (_this$getMap = this.getMap()) === null || _this$getMap === void 0 || (_this$getMap = _this$getMap.container) === null || _this$getMap === void 0 || (_this$getMap = _this$getMap.querySelector('#' + HTML_CONTAINER_ID)) === null || _this$getMap === void 0 || _this$getMap.appendChild(this.container);
95
95
  this.postDomBack && this.postDomBack(this.container, this.source);
96
96
  this.isInit = true;
97
97
  }
package/dist/esm/index.js CHANGED
@@ -50,7 +50,7 @@ loadCss(Cesium.buildModuleUrl('Widgets/widgets.css'));
50
50
  export var DeepTwinsEngine3D = /*#__PURE__*/_createClass(function DeepTwinsEngine3D() {
51
51
  _classCallCheck(this, DeepTwinsEngine3D);
52
52
  });
53
- _defineProperty(DeepTwinsEngine3D, "Version", "0.1.18");
53
+ _defineProperty(DeepTwinsEngine3D, "Version", "0.1.19");
54
54
  _defineProperty(DeepTwinsEngine3D, "Map", Map);
55
55
  _defineProperty(DeepTwinsEngine3D, "GroundSkyBox", GroundSkyBox);
56
56
  _defineProperty(DeepTwinsEngine3D, "RasterLayer", RasterLayer);
@@ -56,8 +56,9 @@ var BaseVideo = /*#__PURE__*/function () {
56
56
  }, {
57
57
  key: "_init",
58
58
  value: function _init() {
59
- var _this = this;
60
- var videoContainer = document.getElementById(VIDEO_CONTAINER_ID);
59
+ var _this$getMap,
60
+ _this = this;
61
+ var videoContainer = (_this$getMap = this.getMap()) === null || _this$getMap === void 0 || (_this$getMap = _this$getMap.container) === null || _this$getMap === void 0 ? void 0 : _this$getMap.querySelector('#' + VIDEO_CONTAINER_ID);
61
62
  if (!videoContainer) {
62
63
  return;
63
64
  }
@@ -19,6 +19,7 @@ import h337 from "../tool/heatmap.js";
19
19
  import * as utils from "../tool/utils";
20
20
  var BaseHeatmap = /*#__PURE__*/function () {
21
21
  function BaseHeatmap() {
22
+ var _this$getMap;
22
23
  var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
23
24
  _classCallCheck(this, BaseHeatmap);
24
25
  _defineProperty(this, "_mapContext", void 0);
@@ -43,7 +44,7 @@ var BaseHeatmap = /*#__PURE__*/function () {
43
44
  var el = document.createElement('div');
44
45
  el.id = this.id;
45
46
  el.style.cssText = 'width: 100%; height: 100%; pointer-events: none; overflow: hidden; opacity: 0;';
46
- var heatmapContainer = document.getElementById(constant.HEATMAP_CONTAINER_ID);
47
+ var heatmapContainer = (_this$getMap = this.getMap()) === null || _this$getMap === void 0 || (_this$getMap = _this$getMap.container) === null || _this$getMap === void 0 ? void 0 : _this$getMap.querySelector('#' + constant.HEATMAP_CONTAINER_ID);
47
48
  if (!heatmapContainer) {
48
49
  return;
49
50
  }