@anov/3d 0.0.134 → 0.0.137

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.
Files changed (59) hide show
  1. package/dist/anov3d.d.ts +2 -2
  2. package/dist/anov3d.js +57 -68
  3. package/dist/anov3d.js.map +1 -1
  4. package/dist/applicationApi.js +58 -21
  5. package/dist/applicationApi.js.map +1 -1
  6. package/dist/factory/3d.js +20 -4
  7. package/dist/factory/3d.js.map +1 -1
  8. package/dist/factory/unit/CameraPoi.js +17 -5
  9. package/dist/factory/unit/CameraPoi.js.map +1 -1
  10. package/dist/factory/unit/cylinder.js +17 -88
  11. package/dist/factory/unit/cylinder.js.map +1 -1
  12. package/dist/factory/unit/index.js +16 -5
  13. package/dist/factory/unit/index.js.map +1 -1
  14. package/dist/module/camera/index.js +15 -3
  15. package/dist/module/camera/index.js.map +1 -1
  16. package/dist/module/entity/dispose.d.ts +6 -0
  17. package/dist/module/entity/dispose.js +38 -0
  18. package/dist/module/entity/dispose.js.map +1 -0
  19. package/dist/module/entity/hybridList.d.ts +11 -0
  20. package/dist/module/entity/hybridList.js +68 -0
  21. package/dist/module/entity/hybridList.js.map +1 -0
  22. package/dist/module/entity/index.d.ts +68 -0
  23. package/dist/module/entity/index.js +389 -0
  24. package/dist/module/entity/index.js.map +1 -0
  25. package/dist/module/entity/poi/constant.d.ts +48 -0
  26. package/dist/module/entity/poi/constant.js +54 -0
  27. package/dist/module/entity/poi/constant.js.map +1 -0
  28. package/dist/module/entity/poi/index.d.ts +13 -0
  29. package/dist/module/entity/poi/index.js +50 -0
  30. package/dist/module/entity/poi/index.js.map +1 -0
  31. package/dist/module/entity/poi/label.d.ts +9 -0
  32. package/dist/module/entity/poi/label.js +46 -0
  33. package/dist/module/entity/poi/label.js.map +1 -0
  34. package/dist/module/entity/poi/resource.d.ts +4 -0
  35. package/dist/module/entity/poi/resource.js +5 -0
  36. package/dist/module/entity/poi/resource.js.map +1 -0
  37. package/dist/module/entity/poi/title.d.ts +77 -0
  38. package/dist/module/entity/poi/title.js +265 -0
  39. package/dist/module/entity/poi/title.js.map +1 -0
  40. package/dist/module/entity/poi/type.d.ts +88 -0
  41. package/dist/module/entity/poi/type.js +8 -0
  42. package/dist/module/entity/poi/type.js.map +1 -0
  43. package/dist/module/entity/strategy.d.ts +3 -0
  44. package/dist/module/entity/strategy.js +27 -0
  45. package/dist/module/entity/strategy.js.map +1 -0
  46. package/dist/module/entity/utils.d.ts +4 -0
  47. package/dist/module/entity/utils.js +5 -0
  48. package/dist/module/entity/utils.js.map +1 -0
  49. package/dist/module/eventBus/index.d.ts +6 -3
  50. package/dist/module/eventBus/index.js +10 -1
  51. package/dist/module/eventBus/index.js.map +1 -1
  52. package/dist/module/scene/index.js +25 -5
  53. package/dist/module/scene/index.js.map +1 -1
  54. package/dist/sdkEntry.js +4 -0
  55. package/dist/sdkEntry.js.map +1 -1
  56. package/dist/utils/messageFn.d.ts +8 -1
  57. package/dist/utils/messageFn.js +7 -2
  58. package/dist/utils/messageFn.js.map +1 -1
  59. package/package.json +5 -5
@@ -0,0 +1,68 @@
1
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
3
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
4
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
5
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
6
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
7
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
8
+ var ListNode = /*#__PURE__*/_createClass(function ListNode(value, key) {
9
+ _classCallCheck(this, ListNode);
10
+ _defineProperty(this, "value", void 0);
11
+ _defineProperty(this, "key", void 0);
12
+ _defineProperty(this, "next", void 0);
13
+ _defineProperty(this, "prev", void 0);
14
+ this.value = value;
15
+ this.key = key;
16
+ this.next = null;
17
+ this.prev = null;
18
+ });
19
+ var HybridList = /*#__PURE__*/function () {
20
+ function HybridList() {
21
+ _classCallCheck(this, HybridList);
22
+ _defineProperty(this, "map", void 0);
23
+ _defineProperty(this, "head", void 0);
24
+ _defineProperty(this, "tail", void 0);
25
+ this.map = new Map();
26
+ this.head = null;
27
+ this.tail = null;
28
+ }
29
+ _createClass(HybridList, [{
30
+ key: "get",
31
+ value: function get(key) {
32
+ var node = this.map.get(key);
33
+ return node ? node.value : null;
34
+ }
35
+ }, {
36
+ key: "update",
37
+ value: function update(key, value) {
38
+ var node = this.map.get(key);
39
+ if (node) node.value = value;
40
+ }
41
+ }, {
42
+ key: "add",
43
+ value: function add(key, value) {
44
+ if (this.map.has(key)) throw new Error("".concat(key, " already exists"));
45
+ var newNode = new ListNode(value, key);
46
+ this.map.set(key, newNode);
47
+ if (this.tail) {
48
+ this.tail.next = newNode;
49
+ newNode.prev = this.tail;
50
+ this.tail = newNode;
51
+ } else {
52
+ this.head = this.tail = newNode;
53
+ }
54
+ }
55
+ }, {
56
+ key: "delete",
57
+ value: function _delete(key) {
58
+ var node = this.map.get(key);
59
+ if (!node) return;
60
+ if (node.prev) node.prev.next = node.next;else this.head = node.next;
61
+ if (node.next) node.next.prev = node.prev;else this.tail = node.prev;
62
+ this.map.delete(key);
63
+ }
64
+ }]);
65
+ return HybridList;
66
+ }();
67
+ export default HybridList;
68
+ //# sourceMappingURL=hybridList.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["ListNode","value","key","next","prev","HybridList","map","Map","head","tail","node","get","has","Error","newNode","set","delete"],"sources":["../../../src/module/entity/hybridList.ts"],"sourcesContent":["class ListNode<T> {\n value: T\n key: string | number\n next: ListNode<T> | null\n prev: ListNode<T> | null\n\n constructor(value: T, key: string | number) {\n this.value = value\n this.key = key\n this.next = null\n this.prev = null\n }\n}\n\nclass HybridList<T> {\n private map: Map<string | number, ListNode<T>>\n private head: ListNode<T> | null\n private tail: ListNode<T> | null\n\n constructor() {\n this.map = new Map<string | number, ListNode<T>>()\n this.head = null\n this.tail = null\n }\n\n get(key: string | number): T | null {\n const node = this.map.get(key)\n return node ? node.value : null\n }\n\n update(key: string | number, value: T): void {\n const node = this.map.get(key)\n if (node)\n node.value = value\n }\n\n add(key: string | number, value: T): void {\n if (this.map.has(key))\n throw new Error(`${key} already exists`)\n\n const newNode = new ListNode(value, key)\n this.map.set(key, newNode)\n\n if (this.tail) {\n this.tail.next = newNode\n newNode.prev = this.tail\n this.tail = newNode\n }\n else {\n this.head = this.tail = newNode\n }\n }\n\n delete(key: string | number): void {\n const node = this.map.get(key)\n\n if (!node)\n return\n\n if (node.prev)\n node.prev.next = node.next\n else\n this.head = node.next\n\n if (node.next)\n node.next.prev = node.prev\n else\n this.tail = node.prev\n\n this.map.delete(key)\n }\n}\n\nexport default HybridList\n"],"mappings":";;;;;;;IAAMA,QAAQ,6BAMZ,kBAAYC,KAAQ,EAAEC,GAAoB,EAAE;EAAA;EAAA;EAAA;EAAA;EAAA;EAC1C,IAAI,CAACD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AAI,CAACC,IAAI,GAAGK,OAAO;MACjC;IACF;EAAC;IAAA;IAAA,OAED,iBAAOZ,GAAoB,EAAQ;MACjC,IAAMQ,IAAI,GAAG,IAAI,CAACJ,GAAG,CAACK,GAAG,CAACT,GAAG,CAAC;MAE9B,IAAI,CAACQ,IAAI,EACP;MAEF,IAAIA,IAAI,CAACN,IAAI,EACXM,IAAI,CAACN,IAAI,CAACD,IAAI,GAAGO,IAAI,CAACP,IAAI,MAE1B,IAAI,CAACK,IAAI,GAAGE,IAAI,CAACP,IAAI;MAEvB,IAAIO,IAAI,CAACP,IAAI,EACXO,IAAI,CAACP,IAAI,CAACC,IAAI,GAAGM,IAAI,CAACN,IAAI,MAE1B,IAAI,CAACK,IAAI,GAAGC,IAAI,CAACN,IAAI;MAEvB,IAAI,CAACE,GAAG,CAACU,MAAM,CAACd,GAAG,CAAC;IACtB;EAAC;EAAA;AAAA;AAGH,eAAeG,UAAU"}
@@ -0,0 +1,68 @@
1
+ import { Group } from '@anov/3d-core';
2
+ import type { BaseModule } from '../../utils/abstract';
3
+ import type Anov3D from '../../sdkEntry';
4
+ import type { PoiDataOpts, PoiOpts } from './poi/type';
5
+ export declare type Enhance = {
6
+ [k in string]: any;
7
+ };
8
+ export declare type Opts = {
9
+ id: string | number;
10
+ } & Enhance;
11
+ export declare type RegisterEvents = {
12
+ eventName: string;
13
+ id: string;
14
+ };
15
+ declare class Entity implements BaseModule {
16
+ app: Anov3D;
17
+ catchStrategy: Map<string, any>;
18
+ constructor(app: Anov3D);
19
+ registerStrategy(entityType: any): Promise<any>;
20
+ singleCreate(id: any, strategy: any, data: PoiDataOpts, group?: Group): Promise<{
21
+ id: any;
22
+ position: any;
23
+ rotation: any;
24
+ scale: any;
25
+ visable: any;
26
+ }>;
27
+ multiCreate(id: any, strategy: any, data: any, legends: any): any[];
28
+ create(json: PoiDataOpts): Promise<{
29
+ id: any;
30
+ position: any;
31
+ rotation: any;
32
+ scale: any;
33
+ visable: any;
34
+ }>;
35
+ create2(json: PoiOpts): Promise<any[] | {
36
+ id: any;
37
+ position: any;
38
+ rotation: any;
39
+ scale: any;
40
+ visable: any;
41
+ }>;
42
+ singleUpdate(id: any, strategy: any, data: PoiDataOpts, group?: Group): Promise<{
43
+ id: any;
44
+ position: any;
45
+ rotation: any;
46
+ scale: any;
47
+ visable: any;
48
+ }>;
49
+ multiUpdate(id: any, strategy: any, data: any, legends: any): any[];
50
+ update(json: PoiDataOpts): Promise<{
51
+ id: any;
52
+ position: any;
53
+ rotation: any;
54
+ scale: any;
55
+ visable: any;
56
+ }>;
57
+ update2(json: PoiOpts): Promise<any[] | {
58
+ id: any;
59
+ position: any;
60
+ rotation: any;
61
+ scale: any;
62
+ visable: any;
63
+ }>;
64
+ delete(json: Opts): void;
65
+ getEntityByName(name: string): void;
66
+ registerEvents(opts: RegisterEvents): void;
67
+ }
68
+ export default Entity;
@@ -0,0 +1,389 @@
1
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
3
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
4
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
5
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
6
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
7
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
8
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
9
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
10
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
11
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
12
+ function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
13
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
14
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
15
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
16
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
17
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
18
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
19
+ import { Group, use } from '@anov/3d-core';
20
+ import { MessageType, sendToMessage } from "../../utils/messageFn";
21
+ import { EMessageStatus } from "../../messageStatus";
22
+ import HybridList from "./hybridList";
23
+ import { entityStrategy } from "./strategy";
24
+ import createDisposeFn from "./dispose";
25
+ var hybridList = new HybridList();
26
+ var Entity = /*#__PURE__*/function () {
27
+ function Entity(app) {
28
+ _classCallCheck(this, Entity);
29
+ _defineProperty(this, "app", void 0);
30
+ _defineProperty(this, "catchStrategy", new Map());
31
+ this.app = app;
32
+ }
33
+ _createClass(Entity, [{
34
+ key: "registerStrategy",
35
+ value: function () {
36
+ var _registerStrategy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(entityType) {
37
+ var strategyMap, strategyClass;
38
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
39
+ while (1) switch (_context.prev = _context.next) {
40
+ case 0:
41
+ strategyMap = _objectSpread({}, entityStrategy);
42
+ if (entityType in strategyMap) {
43
+ _context.next = 3;
44
+ break;
45
+ }
46
+ throw new Error("entityType ".concat(entityType, " is not supported"));
47
+ case 3:
48
+ if (!(entityType in strategyMap && !this.catchStrategy.has(entityType))) {
49
+ _context.next = 8;
50
+ break;
51
+ }
52
+ _context.next = 6;
53
+ return strategyMap[entityType]();
54
+ case 6:
55
+ strategyClass = _context.sent;
56
+ // eslint-disable-next-line new-cap
57
+ this.catchStrategy.set(entityType, new strategyClass());
58
+ case 8:
59
+ return _context.abrupt("return", this.catchStrategy.get(entityType));
60
+ case 9:
61
+ case "end":
62
+ return _context.stop();
63
+ }
64
+ }, _callee, this);
65
+ }));
66
+ function registerStrategy(_x) {
67
+ return _registerStrategy.apply(this, arguments);
68
+ }
69
+ return registerStrategy;
70
+ }()
71
+ }, {
72
+ key: "singleCreate",
73
+ value: function () {
74
+ var _singleCreate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(id, strategy, data, group) {
75
+ var entityInfoArray, targetEntityInfo, entity;
76
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
77
+ while (1) switch (_context2.prev = _context2.next) {
78
+ case 0:
79
+ _context2.next = 2;
80
+ return Promise.allSettled([strategy.create(data)]);
81
+ case 2:
82
+ entityInfoArray = _context2.sent;
83
+ targetEntityInfo = entityInfoArray[0];
84
+ if (!(targetEntityInfo.status === 'rejected')) {
85
+ _context2.next = 6;
86
+ break;
87
+ }
88
+ throw new Error(targetEntityInfo.reason);
89
+ case 6:
90
+ entity = targetEntityInfo.value;
91
+ hybridList.add(id, entity);
92
+ group === null || group === void 0 ? void 0 : group.add(entity);
93
+ return _context2.abrupt("return", {
94
+ id: id,
95
+ position: entity.position,
96
+ rotation: entity.rotation,
97
+ scale: entity.scale,
98
+ visable: entity.visible
99
+ });
100
+ case 10:
101
+ case "end":
102
+ return _context2.stop();
103
+ }
104
+ }, _callee2);
105
+ }));
106
+ function singleCreate(_x2, _x3, _x4, _x5) {
107
+ return _singleCreate.apply(this, arguments);
108
+ }
109
+ return singleCreate;
110
+ }()
111
+ }, {
112
+ key: "multiCreate",
113
+ value: function multiCreate(id, strategy, data, legends) {
114
+ var _this = this;
115
+ var group = new Group();
116
+ var entiryIdArray = data.map( /*#__PURE__*/function () {
117
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(item) {
118
+ var currentData;
119
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
120
+ while (1) switch (_context3.prev = _context3.next) {
121
+ case 0:
122
+ currentData = item;
123
+ if (currentData.legend) {
124
+ currentData = _objectSpread(_objectSpread({}, legends.find(function (legend) {
125
+ return legend.name === item.legend;
126
+ })), item);
127
+ }
128
+ _context3.next = 4;
129
+ return _this.singleCreate(item.id, strategy, currentData, group);
130
+ case 4:
131
+ return _context3.abrupt("return", _context3.sent);
132
+ case 5:
133
+ case "end":
134
+ return _context3.stop();
135
+ }
136
+ }, _callee3);
137
+ }));
138
+ return function (_x6) {
139
+ return _ref.apply(this, arguments);
140
+ };
141
+ }());
142
+ hybridList.add(id, group);
143
+ use.useScene().scene.add(group);
144
+ return [{
145
+ id: id
146
+ }].concat(_toConsumableArray(entiryIdArray));
147
+ }
148
+ }, {
149
+ key: "create",
150
+ value: function () {
151
+ var _create = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(json) {
152
+ var id, type, strategy;
153
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
154
+ while (1) switch (_context4.prev = _context4.next) {
155
+ case 0:
156
+ id = json.id, type = json.type;
157
+ _context4.next = 3;
158
+ return this.registerStrategy(type);
159
+ case 3:
160
+ strategy = _context4.sent;
161
+ return _context4.abrupt("return", this.singleCreate(id, strategy, json));
162
+ case 5:
163
+ case "end":
164
+ return _context4.stop();
165
+ }
166
+ }, _callee4, this);
167
+ }));
168
+ function create(_x7) {
169
+ return _create.apply(this, arguments);
170
+ }
171
+ return create;
172
+ }()
173
+ }, {
174
+ key: "create2",
175
+ value: function () {
176
+ var _create2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(json) {
177
+ var id, type, data, legends, strategy, singeData, _legends$find;
178
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
179
+ while (1) switch (_context5.prev = _context5.next) {
180
+ case 0:
181
+ id = json.id, type = json.type, data = json.data, legends = json.legends;
182
+ _context5.next = 3;
183
+ return this.registerStrategy(type);
184
+ case 3:
185
+ strategy = _context5.sent;
186
+ if (!(Array.isArray(data) && data.length)) {
187
+ _context5.next = 8;
188
+ break;
189
+ }
190
+ return _context5.abrupt("return", Promise.all(this.multiCreate(id, strategy, data, legends)));
191
+ case 8:
192
+ singeData = data;
193
+ if (singeData.legend) {
194
+ singeData = _objectSpread(_objectSpread({}, (_legends$find = legends.find(function (item) {
195
+ return item.name === singeData.legend;
196
+ })) !== null && _legends$find !== void 0 ? _legends$find : {}), singeData);
197
+ }
198
+ return _context5.abrupt("return", this.singleCreate(id, strategy, singeData));
199
+ case 11:
200
+ case "end":
201
+ return _context5.stop();
202
+ }
203
+ }, _callee5, this);
204
+ }));
205
+ function create2(_x8) {
206
+ return _create2.apply(this, arguments);
207
+ }
208
+ return create2;
209
+ }()
210
+ }, {
211
+ key: "singleUpdate",
212
+ value: function () {
213
+ var _singleUpdate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(id, strategy, data, group) {
214
+ var entityInfoArray, targetEntityInfo, entity;
215
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
216
+ while (1) switch (_context6.prev = _context6.next) {
217
+ case 0:
218
+ _context6.next = 2;
219
+ return Promise.allSettled([strategy.update(data)]);
220
+ case 2:
221
+ entityInfoArray = _context6.sent;
222
+ targetEntityInfo = entityInfoArray[0];
223
+ if (!(targetEntityInfo.status === 'rejected')) {
224
+ _context6.next = 6;
225
+ break;
226
+ }
227
+ throw new Error(targetEntityInfo.reason);
228
+ case 6:
229
+ entity = targetEntityInfo.value;
230
+ if (group) {
231
+ group.remove(hybridList.get(id));
232
+ group.add(entity);
233
+ }
234
+ hybridList.update(id, entity);
235
+ return _context6.abrupt("return", {
236
+ id: id,
237
+ position: entity.position,
238
+ rotation: entity.rotation,
239
+ scale: entity.scale,
240
+ visable: entity.visible
241
+ });
242
+ case 10:
243
+ case "end":
244
+ return _context6.stop();
245
+ }
246
+ }, _callee6);
247
+ }));
248
+ function singleUpdate(_x9, _x10, _x11, _x12) {
249
+ return _singleUpdate.apply(this, arguments);
250
+ }
251
+ return singleUpdate;
252
+ }()
253
+ }, {
254
+ key: "multiUpdate",
255
+ value: function multiUpdate(id, strategy, data, legends) {
256
+ var _this2 = this;
257
+ var group = hybridList.get(id);
258
+ var entiryIdArray = data.map( /*#__PURE__*/function () {
259
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(item) {
260
+ var currentData;
261
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
262
+ while (1) switch (_context7.prev = _context7.next) {
263
+ case 0:
264
+ currentData = item;
265
+ if (currentData.legend) {
266
+ currentData = _objectSpread(_objectSpread({}, legends.find(function (legend) {
267
+ return legend.name === item.legend;
268
+ })), item);
269
+ }
270
+ _context7.next = 4;
271
+ return _this2.singleUpdate(item.id, strategy, currentData, group);
272
+ case 4:
273
+ return _context7.abrupt("return", _context7.sent);
274
+ case 5:
275
+ case "end":
276
+ return _context7.stop();
277
+ }
278
+ }, _callee7);
279
+ }));
280
+ return function (_x13) {
281
+ return _ref2.apply(this, arguments);
282
+ };
283
+ }());
284
+ return [{
285
+ id: id
286
+ }].concat(_toConsumableArray(entiryIdArray));
287
+ }
288
+ }, {
289
+ key: "update",
290
+ value: function () {
291
+ var _update = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(json) {
292
+ var id, type, strategy;
293
+ return _regeneratorRuntime().wrap(function _callee8$(_context8) {
294
+ while (1) switch (_context8.prev = _context8.next) {
295
+ case 0:
296
+ id = json.id, type = json.type;
297
+ _context8.next = 3;
298
+ return this.registerStrategy(type);
299
+ case 3:
300
+ strategy = _context8.sent;
301
+ return _context8.abrupt("return", this.singleUpdate(id, strategy, json));
302
+ case 5:
303
+ case "end":
304
+ return _context8.stop();
305
+ }
306
+ }, _callee8, this);
307
+ }));
308
+ function update(_x14) {
309
+ return _update.apply(this, arguments);
310
+ }
311
+ return update;
312
+ }()
313
+ }, {
314
+ key: "update2",
315
+ value: function () {
316
+ var _update2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(json) {
317
+ var id, type, data, legends, strategy, singeData, _legends$find2;
318
+ return _regeneratorRuntime().wrap(function _callee9$(_context9) {
319
+ while (1) switch (_context9.prev = _context9.next) {
320
+ case 0:
321
+ id = json.id, type = json.type, data = json.data, legends = json.legends;
322
+ _context9.next = 3;
323
+ return this.registerStrategy(type);
324
+ case 3:
325
+ strategy = _context9.sent;
326
+ if (!(Array.isArray(data) && data.length)) {
327
+ _context9.next = 8;
328
+ break;
329
+ }
330
+ return _context9.abrupt("return", Promise.all(this.multiUpdate(id, strategy, data, legends)));
331
+ case 8:
332
+ singeData = data;
333
+ if (singeData.legend) {
334
+ singeData = _objectSpread(_objectSpread({}, (_legends$find2 = legends.find(function (item) {
335
+ return item.name === singeData.legend;
336
+ })) !== null && _legends$find2 !== void 0 ? _legends$find2 : {}), singeData);
337
+ }
338
+ return _context9.abrupt("return", this.singleUpdate(id, strategy, data));
339
+ case 11:
340
+ case "end":
341
+ return _context9.stop();
342
+ }
343
+ }, _callee9, this);
344
+ }));
345
+ function update2(_x15) {
346
+ return _update2.apply(this, arguments);
347
+ }
348
+ return update2;
349
+ }()
350
+ }, {
351
+ key: "delete",
352
+ value: function _delete(json) {
353
+ var id = json.id;
354
+ var target = hybridList.get(id);
355
+ if (!target) throw new Error("entity ".concat(id, " is not exist"));
356
+ target.removeFromParent();
357
+ var entityDispose = createDisposeFn();
358
+
359
+ // @ts-ignore
360
+ // eslint-disable-next-line no-proto
361
+ target.__proto__.dispose = entityDispose;
362
+ // @ts-ignore
363
+ target.dispose();
364
+ hybridList.delete(id);
365
+ }
366
+ }, {
367
+ key: "getEntityByName",
368
+ value: function getEntityByName(name) {}
369
+ }, {
370
+ key: "registerEvents",
371
+ value: function registerEvents(opts) {
372
+ var eventName = opts.eventName,
373
+ id = opts.id;
374
+ var target = hybridList.get(id);
375
+ if (!target) throw new Error("entity ".concat(id, " is not exist"));
376
+ this.app.interactionManager.add(target);
377
+ target.addEventListener(eventName, function (e) {
378
+ sendToMessage({
379
+ messageType: MessageType.Event,
380
+ messageName: eventName,
381
+ status: EMessageStatus.Success
382
+ });
383
+ });
384
+ }
385
+ }]);
386
+ return Entity;
387
+ }();
388
+ export default Entity;
389
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["Group","use","MessageType","sendToMessage","EMessageStatus","HybridList","entityStrategy","createDisposeFn","hybridList","Entity","app","Map","entityType","strategyMap","Error","catchStrategy","has","strategyClass","set","get","id","strategy","data","group","Promise","allSettled","create","entityInfoArray","targetEntityInfo","status","reason","entity","value","add","position","rotation","scale","visable","visible","legends","entiryIdArray","map","item","currentData","legend","find","name","singleCreate","useScene","scene","json","type","registerStrategy","Array","isArray","length","all","multiCreate","singeData","update","remove","singleUpdate","multiUpdate","target","removeFromParent","entityDispose","__proto__","dispose","delete","opts","eventName","interactionManager","addEventListener","e","messageType","Event","messageName","Success"],"sources":["../../../src/module/entity/index.ts"],"sourcesContent":["import type { Object3D } from '@anov/3d-core'\nimport { Group, use } from '@anov/3d-core'\nimport type { BaseModule } from '../../utils/abstract'\nimport type Anov3D from '../../sdkEntry'\nimport { MessageType, sendToMessage } from '../../utils/messageFn'\nimport { EMessageStatus } from '../../messageStatus'\nimport HybridList from './hybridList'\nimport { entityStrategy } from './strategy'\nimport createDisposeFn from './dispose'\nimport type { PoiDataOpts, PoiOpts } from './poi/type'\n\nexport type Enhance = {\n [k in string]: any\n}\n\nexport type Opts = {\n id: string | number\n} & Enhance\n\nexport type RegisterEvents = {\n eventName: string\n id: string\n}\n\nconst hybridList = new HybridList<Object3D>()\n\nclass Entity implements BaseModule {\n app: Anov3D\n catchStrategy: Map<string, any> = new Map()\n\n constructor(app: Anov3D) {\n this.app = app\n }\n\n async registerStrategy(entityType) {\n const strategyMap = {\n ...entityStrategy,\n }\n\n if (!(entityType in strategyMap))\n throw new Error(`entityType ${entityType} is not supported`)\n\n if (entityType in strategyMap && !this.catchStrategy.has(entityType)) {\n const strategyClass = await strategyMap[entityType]()\n\n // eslint-disable-next-line new-cap\n this.catchStrategy.set(entityType, new strategyClass())\n }\n\n return this.catchStrategy.get(entityType)\n }\n\n async singleCreate(id, strategy, data: PoiDataOpts, group?: Group) {\n const entityInfoArray = await Promise.allSettled([strategy.create(data)])\n const targetEntityInfo = entityInfoArray[0]\n\n if (targetEntityInfo.status === 'rejected')\n throw new Error(targetEntityInfo.reason)\n\n const entity = targetEntityInfo.value\n\n hybridList.add(id, entity)\n group?.add(entity)\n\n return { id, position: entity.position, rotation: entity.rotation, scale: entity.scale, visable: entity.visible }\n }\n\n multiCreate(id, strategy, data, legends) {\n const group = new Group()\n const entiryIdArray = data.map(async (item) => {\n let currentData = item\n\n if (currentData.legend) {\n currentData = {\n ...legends.find(legend => legend.name === item.legend),\n ...item,\n }\n }\n\n return await this.singleCreate(\n item.id,\n strategy,\n currentData as PoiDataOpts,\n group,\n )\n })\n\n hybridList.add(id, group)\n use.useScene().scene.add(group)\n\n return [{ id }, ...entiryIdArray]\n }\n\n async create(json: PoiDataOpts) {\n const { id, type } = json\n const strategy = await this.registerStrategy(type)\n\n return this.singleCreate(id, strategy, json)\n }\n\n async create2(json: PoiOpts) {\n const { id, type, data, legends } = json\n const strategy = await this.registerStrategy(type)\n\n if (Array.isArray(data) && data.length) {\n return Promise.all(this.multiCreate(id, strategy, data, legends))\n }\n\n else {\n let singeData = data as PoiDataOpts\n\n if (singeData.legend) {\n singeData = {\n ...(legends.find(item => item.name === singeData.legend) ?? {}),\n ...singeData,\n }\n }\n\n return this.singleCreate(id, strategy, singeData as PoiDataOpts)\n }\n }\n\n async singleUpdate(id, strategy, data: PoiDataOpts, group?: Group) {\n const entityInfoArray = await Promise.allSettled([strategy.update(data)])\n const targetEntityInfo = entityInfoArray[0]\n\n if (targetEntityInfo.status === 'rejected')\n throw new Error(targetEntityInfo.reason)\n\n const entity = targetEntityInfo.value\n\n if (group) {\n group.remove(hybridList.get(id))\n group.add(entity)\n }\n\n hybridList.update(id, entity)\n\n return { id, position: entity.position, rotation: entity.rotation, scale: entity.scale, visable: entity.visible }\n }\n\n multiUpdate(id, strategy, data, legends) {\n const group = hybridList.get(id) as Group\n\n const entiryIdArray = data.map(async (item) => {\n let currentData = item\n\n if (currentData.legend) {\n currentData = {\n ...legends.find(legend => legend.name === item.legend),\n ...item,\n }\n }\n\n return await this.singleUpdate(\n item.id,\n strategy,\n currentData as PoiDataOpts,\n group,\n )\n })\n\n return [{ id }, ...entiryIdArray]\n }\n\n async update(json: PoiDataOpts) {\n const { id, type } = json\n const strategy = await this.registerStrategy(type)\n\n return this.singleUpdate(id, strategy, json)\n }\n\n async update2(json: PoiOpts) {\n const { id, type, data, legends } = json\n const strategy = await this.registerStrategy(type)\n\n if (Array.isArray(data) && data.length) {\n return Promise.all(this.multiUpdate(id, strategy, data, legends))\n }\n\n else {\n let singeData = data as PoiDataOpts\n\n if (singeData.legend) {\n singeData = {\n ...(legends.find(item => item.name === singeData.legend) ?? {}),\n ...singeData,\n }\n }\n\n return this.singleUpdate(id, strategy, data as PoiDataOpts)\n }\n }\n\n delete(json: Opts) {\n const { id } = json\n const target = hybridList.get(id)\n\n if (!target)\n throw new Error(`entity ${id} is not exist`)\n\n target.removeFromParent()\n const entityDispose = createDisposeFn()\n\n // @ts-ignore\n // eslint-disable-next-line no-proto\n target.__proto__.dispose = entityDispose\n // @ts-ignore\n target.dispose()\n\n hybridList.delete(id)\n }\n\n getEntityByName(name: string) {}\n\n registerEvents(opts: RegisterEvents) {\n const { eventName, id } = opts\n const target = hybridList.get(id)\n\n if (!target)\n throw new Error(`entity ${id} is not exist`)\n\n this.app.interactionManager.add(target)\n\n target.addEventListener(eventName, (e) => {\n sendToMessage({\n messageType: MessageType.Event,\n messageName: eventName,\n status: EMessageStatus.Success,\n })\n })\n }\n}\n\nexport default Entity"],"mappings":";;;;;;;+CACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,SAASA,KAAK,EAAEC,GAAG,QAAQ,eAAe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GF,aAAa;MACxC;MACAF,MAAM,CAACI,OAAO,EAAE;MAEhB3D,UAAU,CAAC4D,MAAM,CAAChD,EAAE,CAAC;IACvB;EAAC;IAAA;IAAA,OAED,yBAAgB0B,IAAY,EAAE,CAAC;EAAC;IAAA;IAAA,OAEhC,wBAAeuB,IAAoB,EAAE;MACnC,IAAQC,SAAS,GAASD,IAAI,CAAtBC,SAAS;QAAElD,EAAE,GAAKiD,IAAI,CAAXjD,EAAE;MACrB,IAAM2C,MAAM,GAAGvD,UAAU,CAACW,GAAG,CAACC,EAAE,CAAC;MAEjC,IAAI,CAAC2C,MAAM,EACT,MAAM,IAAIjD,KAAK,kBAAWM,EAAE,mBAAgB;MAE9C,IAAI,CAACV,GAAG,CAAC6D,kBAAkB,CAACtC,GAAG,CAAC8B,MAAM,CAAC;MAEvCA,MAAM,CAACS,gBAAgB,CAACF,SAAS,EAAE,UAACG,CAAC,EAAK;QACxCtE,aAAa,CAAC;UACZuE,WAAW,EAAExE,WAAW,CAACyE,KAAK;UAC9BC,WAAW,EAAEN,SAAS;UACtBzC,MAAM,EAAEzB,cAAc,CAACyE;QACzB,CAAC,CAAC;MACJ,CAAC,CAAC;IACJ;EAAC;EAAA;AAAA;AAGH,eAAepE,MAAM"}
@@ -0,0 +1,48 @@
1
+ export declare const TitleStyle: {
2
+ container: {
3
+ position: string;
4
+ display: string;
5
+ 'min-width': string;
6
+ height: string;
7
+ };
8
+ border: {
9
+ position: string;
10
+ display: string;
11
+ width: string;
12
+ height: string;
13
+ 'text-align': string;
14
+ background: string;
15
+ 'background-size': string;
16
+ };
17
+ icon: {
18
+ position: string;
19
+ top: string;
20
+ left: string;
21
+ width: string;
22
+ height: string;
23
+ background: string;
24
+ 'background-size': string;
25
+ transform: string;
26
+ };
27
+ text: {
28
+ 'font-size': string;
29
+ color: string;
30
+ position: string;
31
+ left: string;
32
+ 'max-width': string;
33
+ 'white-space': string;
34
+ 'line-height': string;
35
+ overflow: string;
36
+ 'text-overflow': string;
37
+ };
38
+ needle: {
39
+ position: string;
40
+ top: string;
41
+ left: string;
42
+ width: string;
43
+ height: string;
44
+ background: string;
45
+ 'background-size': string;
46
+ transform: string;
47
+ };
48
+ };