@anov/3d 0.0.134 → 0.0.136

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,265 @@
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 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; }
3
+ 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; }
4
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
5
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
6
+ 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); }
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 _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
9
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
10
+ 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; }
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 { Poi, RenderType } from '@anov/3d-ability';
20
+ import { Vector3, use } from '@anov/3d-core';
21
+ import { BORDER_01, ICON_01, NEEDLE_01, NEEDLE_02 } from "./resource";
22
+ var SpriteScale = 80;
23
+ var TitlePoi = /*#__PURE__*/function () {
24
+ function TitlePoi() {
25
+ _classCallCheck(this, TitlePoi);
26
+ _defineProperty(this, "mesh", void 0);
27
+ }
28
+ _createClass(TitlePoi, [{
29
+ key: "generateDom",
30
+ value: function generateDom(property) {
31
+ // 根据property还原dom
32
+ var type = property.style;
33
+ var style = this.getStyle();
34
+ var dom;
35
+ switch (true) {
36
+ case type.includes('title_pin_01'):
37
+ dom = this.pin01(property, style);
38
+ break;
39
+ case type.includes('title_pin_02'):
40
+ dom = this.pin02(property, style);
41
+ break;
42
+ case type.includes('title_'):
43
+ dom = this.title01(property, style);
44
+ break;
45
+ default:
46
+ }
47
+ var container = document.createElement('div');
48
+ container.appendChild(dom);
49
+ return container;
50
+ }
51
+ }, {
52
+ key: "create",
53
+ value: function () {
54
+ var _create = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(property) {
55
+ var dom, poi;
56
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
57
+ while (1) switch (_context.prev = _context.next) {
58
+ case 0:
59
+ dom = this.generateDom(property);
60
+ poi = new Poi(property.renderType, dom);
61
+ _context.next = 4;
62
+ return poi.loaded;
63
+ case 4:
64
+ this.mesh = poi.mesh;
65
+ this.setScale(this.mesh, property, dom);
66
+ property.position && this.mesh.position.copy(new Vector3().fromArray(property.position));
67
+ use.useScene().scene.add(this.mesh);
68
+ return _context.abrupt("return", this.mesh);
69
+ case 9:
70
+ case "end":
71
+ return _context.stop();
72
+ }
73
+ }, _callee, this);
74
+ }));
75
+ function create(_x) {
76
+ return _create.apply(this, arguments);
77
+ }
78
+ return create;
79
+ }()
80
+ }, {
81
+ key: "update",
82
+ value: function () {
83
+ var _update = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(property) {
84
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
85
+ while (1) switch (_context2.prev = _context2.next) {
86
+ case 0:
87
+ this.mesh.removeFromParent();
88
+ this.mesh.remove();
89
+ _context2.next = 4;
90
+ return this.create(property);
91
+ case 4:
92
+ return _context2.abrupt("return", this.mesh);
93
+ case 5:
94
+ case "end":
95
+ return _context2.stop();
96
+ }
97
+ }, _callee2, this);
98
+ }));
99
+ function update(_x2) {
100
+ return _update.apply(this, arguments);
101
+ }
102
+ return update;
103
+ }()
104
+ }, {
105
+ key: "setScale",
106
+ value: function setScale(mesh, property, dom) {
107
+ var _this$getDomSize = this.getDomSize(dom),
108
+ width = _this$getDomSize.width,
109
+ height = _this$getDomSize.height;
110
+ var _property$scale = property.scale,
111
+ scale = _property$scale === void 0 ? [0, 0, 0] : _property$scale,
112
+ renderType = property.renderType;
113
+ var _scale = scale,
114
+ _scale2 = _slicedToArray(_scale, 3),
115
+ x = _scale2[0],
116
+ y = _scale2[1],
117
+ z = _scale2[2];
118
+ if (renderType === RenderType.Sprite) {
119
+ scale = [x + SpriteScale, y + height / width * SpriteScale, z];
120
+ mesh.scale.copy(new Vector3().fromArray(scale));
121
+ } else if (renderType === RenderType.Fixed) {
122
+ dom.style.transform = "scale(".concat(x, ")");
123
+ } else if (renderType === RenderType.Plane) {
124
+ mesh.scale.copy(new Vector3().fromArray(scale));
125
+ }
126
+ }
127
+ }, {
128
+ key: "getDomSize",
129
+ value: function getDomSize(dom) {
130
+ var cloneDom = dom.cloneNode(true);
131
+ cloneDom.style.top = '-1000px';
132
+ cloneDom.style.position = 'absolute';
133
+ document.body.appendChild(cloneDom);
134
+ var rect = cloneDom.getBoundingClientRect();
135
+ var _ref = [rect.width, rect.height],
136
+ width = _ref[0],
137
+ height = _ref[1];
138
+ document.body.removeChild(cloneDom);
139
+ return {
140
+ width: width,
141
+ height: height
142
+ };
143
+ }
144
+ }, {
145
+ key: "applyStyles",
146
+ value: function applyStyles(element, styles) {
147
+ Object.assign(element.style, styles);
148
+ }
149
+ }, {
150
+ key: "createElementWithStyles",
151
+ value: function createElementWithStyles(tag, styles, textContent) {
152
+ var element = document.createElement(tag);
153
+ this.applyStyles(element, styles);
154
+ if (textContent) element.textContent = textContent;
155
+ return element;
156
+ }
157
+ }, {
158
+ key: "createPOIBase",
159
+ value: function createPOIBase(property, style) {
160
+ if (property.textProperty) {
161
+ style.text = _objectSpread(_objectSpread({}, style.text), property.textProperty);
162
+ var fontSize = style.text.fontSize;
163
+ if (!isNaN(fontSize)) style.text.fontSize = "".concat(fontSize, "px");
164
+ }
165
+ if (property.icon) style.icon.background = "url(".concat(property.icon, ") no-repeat center center");
166
+ var container = this.createElementWithStyles('div', style.container);
167
+ var border = this.createElementWithStyles('div', style.border);
168
+ var icon = this.createElementWithStyles('div', style.icon);
169
+ var text = this.createElementWithStyles('div', style.text, property.text);
170
+ border.append(icon, text);
171
+ container.appendChild(border);
172
+ return container;
173
+ }
174
+ }, {
175
+ key: "title01",
176
+ value: function title01(property, style) {
177
+ return this.createPOIBase(property, style);
178
+ }
179
+ }, {
180
+ key: "pin01",
181
+ value: function pin01(property, style) {
182
+ style.container = _objectSpread(_objectSpread({}, style.container), style.style.title_pin_01.container);
183
+ style.needle = _objectSpread(_objectSpread({}, style.needle), style.style.title_pin_01.needle);
184
+ var container = this.createPOIBase(property, style);
185
+ var needle = this.createElementWithStyles('div', style.needle);
186
+ container.appendChild(needle);
187
+ return container;
188
+ }
189
+ }, {
190
+ key: "pin02",
191
+ value: function pin02(property, style) {
192
+ style.container = _objectSpread(_objectSpread({}, style.container), style.style.title_pin_02.container);
193
+ style.needle = _objectSpread(_objectSpread({}, style.needle), style.style.title_pin_02.needle);
194
+ var container = this.createPOIBase(property, style);
195
+ var needle = this.createElementWithStyles('div', style.needle);
196
+ container.appendChild(needle);
197
+ return container;
198
+ }
199
+ }, {
200
+ key: "getStyle",
201
+ value: function getStyle() {
202
+ return {
203
+ container: {
204
+ 'position': 'relative',
205
+ 'display': 'flex',
206
+ 'align-items': 'center'
207
+ },
208
+ border: {
209
+ 'text-align': 'center',
210
+ 'background': "url(".concat(BORDER_01, ") no-repeat"),
211
+ 'background-size': '100% 100%',
212
+ 'display': 'flex',
213
+ 'align-items': 'center',
214
+ 'padding': '8px 20px'
215
+ // 'justify-content': 'center',
216
+ // 'border-image-source': 'url(./poi/border01.png)',
217
+ // 'border-image-slice': '18 18 fill', /* 九宫格裁剪,填充方式为拉伸 */
218
+ // 'border-image-width': '18px 18px',
219
+ },
220
+
221
+ icon: {
222
+ 'width': '36px',
223
+ 'height': '36px',
224
+ 'background': "url(".concat(ICON_01, ") no-repeat center center"),
225
+ 'background-size': 'contain'
226
+ },
227
+ text: {
228
+ 'font-size': '18px',
229
+ 'color': '#ffffff',
230
+ 'margin-left': '16px'
231
+ },
232
+ needle: {},
233
+ style: {
234
+ title_pin_01: {
235
+ container: {
236
+ 'flex-flow': 'column'
237
+ },
238
+ needle: {
239
+ 'width': '43px',
240
+ 'height': '200px',
241
+ 'background': "url(".concat(NEEDLE_01, ") no-repeat center center"),
242
+ 'background-size': 'contain'
243
+ }
244
+ },
245
+ title_pin_02: {
246
+ container: {
247
+ 'flex-flow': 'row-reverse'
248
+ },
249
+ needle: {
250
+ 'width': '124px',
251
+ 'height': '53px',
252
+ 'margin-top': '20px',
253
+ 'margin-right': '4px',
254
+ 'background': "url(".concat(NEEDLE_02, ") no-repeat center center"),
255
+ 'background-size': 'contain'
256
+ }
257
+ }
258
+ }
259
+ };
260
+ }
261
+ }]);
262
+ return TitlePoi;
263
+ }();
264
+ export default TitlePoi;
265
+ //# sourceMappingURL=title.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["Poi","RenderType","Vector3","use","BORDER_01","ICON_01","NEEDLE_01","NEEDLE_02","SpriteScale","TitlePoi","property","type","style","getStyle","dom","includes","pin01","pin02","title01","container","document","createElement","appendChild","generateDom","poi","renderType","loaded","mesh","setScale","position","copy","fromArray","useScene","scene","add","removeFromParent","remove","create","getDomSize","width","height","scale","x","y","z","Sprite","Fixed","transform","Plane","cloneDom","cloneNode","top","body","rect","getBoundingClientRect","removeChild","element","styles","Object","assign","tag","textContent","applyStyles","textProperty","text","fontSize","isNaN","icon","background","createElementWithStyles","border","append","createPOIBase","title_pin_01","needle","title_pin_02"],"sources":["../../../../src/module/entity/poi/title.ts"],"sourcesContent":["import { Poi, RenderType } from '@anov/3d-ability'\nimport type { Object3D } from '@anov/3d-core'\nimport { Vector3, use } from '@anov/3d-core'\nimport { BORDER_01, ICON_01, NEEDLE_01, NEEDLE_02 } from './resource'\nimport type { PoiDataOpts } from './type'\n\nconst SpriteScale = 80\nclass TitlePoi {\n mesh: Object3D\n\n generateDom(property: PoiDataOpts) {\n // 根据property还原dom\n const { style: type } = property\n const style = this.getStyle()\n\n let dom\n switch (true) {\n case type.includes('title_pin_01'):\n dom = this.pin01(property, style)\n break\n case type.includes('title_pin_02'):\n dom = this.pin02(property, style)\n break\n case type.includes('title_'):\n dom = this.title01(property, style)\n break\n default:\n }\n\n const container = document.createElement('div')\n container.appendChild(dom)\n return container\n }\n\n async create(property: PoiDataOpts) {\n const dom = this.generateDom(property)\n const poi = new Poi(property.renderType, dom)\n await poi.loaded\n this.mesh = poi.mesh\n this.setScale(this.mesh, property, dom)\n property.position && this.mesh.position.copy(new Vector3().fromArray(property.position))\n use.useScene().scene.add(this.mesh)\n\n return this.mesh\n }\n\n async update(property: PoiDataOpts) {\n this.mesh.removeFromParent()\n this.mesh.remove()\n await this.create(property)\n return this.mesh\n }\n\n setScale(mesh, property, dom) {\n const { width, height } = this.getDomSize(dom)\n let { scale = [0, 0, 0], renderType } = property\n const [x, y, z] = scale\n if (renderType === RenderType.Sprite) {\n scale = [x + SpriteScale, y + height / width * SpriteScale, z]\n mesh.scale.copy(new Vector3().fromArray(scale))\n }\n else if (renderType === RenderType.Fixed) {\n dom.style.transform = `scale(${x})`\n }\n else if (renderType === RenderType.Plane) {\n mesh.scale.copy(new Vector3().fromArray(scale))\n }\n }\n\n getDomSize(dom) {\n const cloneDom = dom.cloneNode(true)\n cloneDom.style.top = '-1000px'\n cloneDom.style.position = 'absolute'\n\n document.body.appendChild(cloneDom)\n const rect = cloneDom.getBoundingClientRect()\n const [width, height] = [rect.width, rect.height]\n document.body.removeChild(cloneDom)\n return { width, height }\n }\n\n applyStyles(element: HTMLElement, styles: { [key: string]: string }) {\n Object.assign(element.style, styles)\n }\n\n createElementWithStyles(tag: string, styles: { [key: string]: string }, textContent?: string): HTMLElement {\n const element = document.createElement(tag)\n this.applyStyles(element, styles)\n if (textContent)\n element.textContent = textContent\n\n return element\n }\n\n createPOIBase(property: PoiDataOpts, style: any): HTMLElement {\n if (property.textProperty) {\n style.text = { ...style.text, ...property.textProperty }\n const { fontSize } = style.text\n if (!isNaN(fontSize))\n style.text.fontSize = `${fontSize}px`\n }\n if (property.icon)\n style.icon.background = `url(${property.icon}) no-repeat center center`\n\n const container = this.createElementWithStyles('div', style.container)\n const border = this.createElementWithStyles('div', style.border)\n const icon = this.createElementWithStyles('div', style.icon)\n const text = this.createElementWithStyles('div', style.text, property.text)\n\n border.append(icon, text)\n container.appendChild(border)\n\n return container\n }\n\n title01(property: PoiDataOpts, style: any): HTMLElement {\n return this.createPOIBase(property, style)\n }\n\n pin01(property: PoiDataOpts, style: any): HTMLElement {\n style.container = { ...style.container, ...style.style.title_pin_01.container }\n style.needle = { ...style.needle, ...style.style.title_pin_01.needle }\n\n const container = this.createPOIBase(property, style)\n const needle = this.createElementWithStyles('div', style.needle)\n container.appendChild(needle)\n return container\n }\n\n pin02(property: PoiDataOpts, style: any): HTMLElement {\n style.container = { ...style.container, ...style.style.title_pin_02.container }\n style.needle = { ...style.needle, ...style.style.title_pin_02.needle }\n\n const container = this.createPOIBase(property, style)\n const needle = this.createElementWithStyles('div', style.needle)\n container.appendChild(needle)\n return container\n }\n\n getStyle() {\n return {\n container: {\n 'position': 'relative',\n 'display': 'flex',\n 'align-items': 'center',\n },\n border: {\n 'text-align': 'center',\n 'background': `url(${BORDER_01}) no-repeat`,\n 'background-size': '100% 100%',\n 'display': 'flex',\n 'align-items': 'center',\n 'padding': '8px 20px',\n // 'justify-content': 'center',\n // 'border-image-source': 'url(./poi/border01.png)',\n // 'border-image-slice': '18 18 fill', /* 九宫格裁剪,填充方式为拉伸 */\n // 'border-image-width': '18px 18px',\n },\n icon: {\n 'width': '36px',\n 'height': '36px',\n 'background': `url(${ICON_01}) no-repeat center center`,\n 'background-size': 'contain',\n },\n text: {\n 'font-size': '18px',\n 'color': '#ffffff',\n 'margin-left': '16px',\n },\n needle: {},\n style: {\n title_pin_01: {\n container: {\n 'flex-flow': 'column',\n },\n needle: {\n 'width': '43px',\n 'height': '200px',\n 'background': `url(${NEEDLE_01}) no-repeat center center`,\n 'background-size': 'contain',\n },\n },\n title_pin_02: {\n container: {\n 'flex-flow': 'row-reverse',\n },\n needle: {\n 'width': '124px',\n 'height': '53px',\n 'margin-top': '20px',\n 'margin-right': '4px',\n 'background': `url(${NEEDLE_02}) no-repeat center center`,\n 'background-size': 'contain',\n },\n },\n },\n }\n }\n}\n\nexport default TitlePoi"],"mappings":";;;;;;;;;+CACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AADA,SAASA,GAAG,EAAEC,UAAU,QAAQ,kBAAkB;AAElD,SAASC,OAAO,EAAEC,GAAG,QAAQ,eAAe;AAC5C,SAASC,SAAS,EAAEC,OAAO,EAAEC,SAAS,EAAEC,SAAS;AAGjD,IAAMC,WAAW,GAAG,EAAE;AAAA,IAChBC,QAAQ;EAAA;IAAA;IAAA;EAAA;EAAA;IAAA;IAAA,OAGZ,qBAAYC,QAAqB,EAAE;MACjC;MACA,IAAeC,IAAI,GAAKD,QAAQ,CAAxBE,KAAK;MACb,IAAMA,KAAK,GAAG,IAAI,CAACC,QAAQ,EAAE;MAE7B,IAAIC,GAAG;MACP,QAAQ,IAAI;QACV,KAAKH,IAAI,CAACI,QAAQ,CAAC,cAAc,CAAC;UAChCD,GAAG,GAAG,IAAI,CAACE,KAAK,CAACN,QAAQ,EAAEE,KAAK,CAAC;UACjC;QACF,KAAKD,IAAI,CAACI,QAAQ,CAAC,cAAc,CAAC;UAChCD,GAAG,GAAG,IAAI,CAACG,KAAK,CAACP,QAAQ,EAAEE,KAAK,CAAC;UACjC;QACF,KAAKD,IAAI,CAACI,QAAQ,CAAC,QAAQ,CAAC;UAC1BD,GAAG,GAAG,IAAI,CAACI,OAAO,CAACR,QAAQ,EAAEE,KAAK,CAAC;UACnC;QACF;MAAQ;MAGV,IAAMO,SAAS,GAAGC,QAAQ,CAACC,aAAa,CAAC,KAAK,CAAC;MAC/CF,SAAS,CAACG,WAAW,CAACR,GAAG,CAAC;MAC1B,OAAOK,SAAS;IAClB;EAAC;IAAA;IAAA;MAAA,yEAED,iBAAaT,QAAqB;QAA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AAY,EAAE,MAAM;cACpB,cAAc,EAAE,KAAK;cACrB,YAAY,gBAASnE,SAAS,8BAA2B;cACzD,iBAAiB,EAAE;YACrB;UACF;QACF;MACF,CAAC;IACH;EAAC;EAAA;AAAA;AAGH,eAAeE,QAAQ"}
@@ -0,0 +1,88 @@
1
+ import type { RenderType } from '@anov/3d-ability';
2
+ import type { Enhance } from '../index';
3
+ declare type Triple = [number, number, number];
4
+ declare type BaseProperty = {
5
+ id: string;
6
+ visible?: boolean;
7
+ position?: Triple;
8
+ scale?: Triple;
9
+ rotation?: Triple;
10
+ renderType?: RenderType;
11
+ };
12
+ export declare type TextProperty = BaseProperty & {
13
+ text?: string;
14
+ fontSize?: number;
15
+ fontColor?: string;
16
+ fontWeight?: 'normal' | 'bold';
17
+ fontFamily?: string;
18
+ offset?: number;
19
+ };
20
+ export declare type IconProperty = BaseProperty & {
21
+ icon?: string;
22
+ color?: string;
23
+ offset?: number;
24
+ };
25
+ export declare type ImageProperty = BaseProperty & {
26
+ image?: string;
27
+ color?: string;
28
+ offset?: number;
29
+ };
30
+ export declare type TitleProperty = BaseProperty & {
31
+ type: string;
32
+ text?: string;
33
+ icon?: string;
34
+ image?: string;
35
+ textProperty?: TextProperty;
36
+ iconPropery?: IconProperty;
37
+ imageProperty?: ImageProperty;
38
+ };
39
+ declare type TextPropertyOpts = {
40
+ fontSize: number | string;
41
+ fontColor: string;
42
+ fontWeight: number;
43
+ fontFamily: string;
44
+ offset: number;
45
+ scale: number;
46
+ } & Enhance;
47
+ declare type IconPropertyOpts = {
48
+ color: string;
49
+ offset: number;
50
+ scale: number;
51
+ } & Enhance;
52
+ declare type LegendsOpts = {
53
+ name: string;
54
+ type: string;
55
+ textProperty?: Partial<TextPropertyOpts>;
56
+ iconProperty?: Partial<IconPropertyOpts>;
57
+ imageProperty?: Partial<ImageProperty>;
58
+ } & Enhance;
59
+ export declare type PoiDataOpts = Partial<{
60
+ text: string;
61
+ icon: string;
62
+ image: string;
63
+ visible: boolean;
64
+ position: number[];
65
+ scale: number[];
66
+ rotation: number[];
67
+ coord: number[];
68
+ renderType: RenderType;
69
+ legends: string;
70
+ style: string;
71
+ textProperty?: Partial<TextPropertyOpts>;
72
+ iconProperty?: Partial<IconPropertyOpts>;
73
+ imageProperty?: Partial<ImageProperty>;
74
+ }> & {
75
+ id: string;
76
+ type: string;
77
+ } & Enhance;
78
+ export declare type PoiOpts = {
79
+ id: string;
80
+ name?: string;
81
+ type: 'poi';
82
+ legends?: LegendsOpts[];
83
+ data: PoiDataOpts | PoiDataOpts[];
84
+ };
85
+ export declare const TypeMappings: {
86
+ [key: string]: string;
87
+ };
88
+ export {};
@@ -0,0 +1,8 @@
1
+ // 定义基础属性类型
2
+
3
+ export var TypeMappings = {
4
+ title_: 'title',
5
+ icon_: 'icon',
6
+ text_: 'label'
7
+ };
8
+ //# sourceMappingURL=type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["TypeMappings","title_","icon_","text_"],"sources":["../../../../src/module/entity/poi/type.ts"],"sourcesContent":["import type { RenderType } from '@anov/3d-ability'\n\nimport type { Enhance } from '../index'\n\ntype Triple = [number, number, number]\n\n// 定义基础属性类型\ntype BaseProperty = {\n id: string\n visible?: boolean // 可选,可见性,默认 true\n position?: Triple // 可选,默认为 [0,0,0] 即项目原点\n scale?: Triple // 可选,默认 1\n rotation?: Triple // 可选,默认为 [0, 0, 0]\n renderType?: RenderType // 渲染类型\n}\n\nexport type TextProperty = BaseProperty & {\n text?: string\n fontSize?: number\n fontColor?: string\n fontWeight?: 'normal' | 'bold'\n fontFamily?: string\n offset?: number // 可选,默认 0\n}\n\nexport type IconProperty = BaseProperty & {\n icon?: string // 可选,内置编码\n color?: string // 可选,默认 #ffffff\n offset?: number // 可选,默认 0\n}\n\nexport type ImageProperty = BaseProperty & {\n image?: string // 可选,内置编码\n color?: string // 可选,默认 #ffffff\n offset?: number // 可选,默认 0\n}\n\nexport type TitleProperty = BaseProperty & {\n type: string // 内置编码\n text?: string // 可选\n icon?: string // 可选,内置编码\n image?: string // 可选,图片路径\n textProperty?: TextProperty\n iconPropery?: IconProperty\n imageProperty?: ImageProperty\n}\n\ntype TextPropertyOpts = {\n fontSize: number | string\n fontColor: string\n fontWeight: number\n fontFamily: string\n offset: number\n scale: number\n} & Enhance\n\ntype IconPropertyOpts = {\n color: string\n offset: number\n scale: number\n} & Enhance\n\ntype LegendsOpts = {\n name: string\n type: string\n textProperty?: Partial<TextPropertyOpts>\n iconProperty?: Partial<IconPropertyOpts>\n imageProperty?: Partial<ImageProperty>\n} & Enhance\n\nexport type PoiDataOpts = Partial<{\n text: string\n icon: string\n image: string\n visible: boolean\n position: number[]\n scale: number[]\n rotation: number[]\n coord: number[]\n renderType: RenderType // 渲染类型\n legends: string\n style: string\n textProperty?: Partial<TextPropertyOpts>\n iconProperty?: Partial<IconPropertyOpts>\n imageProperty?: Partial<ImageProperty>\n}> & {\n id: string\n type: string\n} & Enhance\n\nexport type PoiOpts = {\n id: string\n name?: string\n type: 'poi'\n legends?: LegendsOpts[]\n data: PoiDataOpts | PoiDataOpts[]\n}\n\nexport const TypeMappings: { [key: string]: string } = {\n title_: 'title',\n icon_: 'icon',\n text_: 'label',\n}"],"mappings":"AAMA;;AA4FA,OAAO,IAAMA,YAAuC,GAAG;EACrDC,MAAM,EAAE,OAAO;EACfC,KAAK,EAAE,MAAM;EACbC,KAAK,EAAE;AACT,CAAC"}
@@ -0,0 +1,3 @@
1
+ export declare const entityStrategy: {
2
+ poi: () => Promise<typeof import("./poi").default>;
3
+ };
@@ -0,0 +1,27 @@
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 _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; }
3
+ 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); } }
4
+ 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); }); }; }
5
+ export var entityStrategy = {
6
+ poi: function () {
7
+ var _poi = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
8
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
9
+ while (1) switch (_context.prev = _context.next) {
10
+ case 0:
11
+ _context.next = 2;
12
+ return import("./poi");
13
+ case 2:
14
+ return _context.abrupt("return", _context.sent.default);
15
+ case 3:
16
+ case "end":
17
+ return _context.stop();
18
+ }
19
+ }, _callee);
20
+ }));
21
+ function poi() {
22
+ return _poi.apply(this, arguments);
23
+ }
24
+ return poi;
25
+ }()
26
+ };
27
+ //# sourceMappingURL=strategy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["entityStrategy","poi","default"],"sources":["../../../src/module/entity/strategy.ts"],"sourcesContent":["export const entityStrategy = {\n poi: async () => (await import('./poi')).default,\n}\n"],"mappings":";+CACA;AAAA;AAAA;AADA,OAAO,IAAMA,cAAc,GAAG;EAC5BC,GAAG;IAAA,sEAAE;MAAA;QAAA;UAAA;YAAA;YAAA,OAAmB,MAAM,SAAS;UAAA;YAAA,+CAAEC,OAAO;UAAA;UAAA;YAAA;QAAA;MAAA;IAAA;IAAA;MAAA;IAAA;IAAA;EAAA;AAClD,CAAC"}
@@ -0,0 +1,4 @@
1
+ /**
2
+ * todo: convert return entity
3
+ */
4
+ declare const convertReturn: () => void;
@@ -0,0 +1,5 @@
1
+ /**
2
+ * todo: convert return entity
3
+ */
4
+ var convertReturn = function convertReturn() {};
5
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["convertReturn"],"sources":["../../../src/module/entity/utils.ts"],"sourcesContent":["/**\n * todo: convert return entity\n */\nconst convertReturn = () => {}\n"],"mappings":"AAAA;AACA;AACA;AACA,IAAMA,aAAa,GAAG,SAAhBA,aAAa,GAAS,CAAC,CAAC"}
@@ -1,16 +1,19 @@
1
+ import type { BaseModule } from '../../utils/abstract';
2
+ import type Anov3D from '../../sdkEntry';
1
3
  /**
2
4
  * notes: 区别于前端概念,3端统一API特定
3
5
  */
4
- declare class EventBus {
6
+ declare class EventBus implements BaseModule {
5
7
  eventMap: Map<string, boolean>;
6
- constructor();
8
+ app: Anov3D;
9
+ constructor(app: Anov3D);
7
10
  /**
8
11
  * open event
9
12
  * @param params
10
13
  */
11
14
  on(params: {
12
15
  eventName: string;
13
- entityId?: string;
16
+ id?: string;
14
17
  }): {
15
18
  eventName: string;
16
19
  };
@@ -9,9 +9,11 @@ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input ==
9
9
  * notes: 区别于前端概念,3端统一API特定
10
10
  */
11
11
  var EventBus = /*#__PURE__*/function () {
12
- function EventBus() {
12
+ function EventBus(app) {
13
13
  _classCallCheck(this, EventBus);
14
14
  _defineProperty(this, "eventMap", new Map());
15
+ _defineProperty(this, "app", void 0);
16
+ this.app = app;
15
17
  }
16
18
 
17
19
  /**
@@ -22,6 +24,13 @@ var EventBus = /*#__PURE__*/function () {
22
24
  key: "on",
23
25
  value: function on(params) {
24
26
  this.eventMap.set("".concat(params.eventName), true);
27
+ if (params.id && params.eventName === 'click') {
28
+ // @ts-ignore
29
+ this.app.entity.registerEvents({
30
+ eventName: params.eventName,
31
+ id: params.id
32
+ });
33
+ }
25
34
  return {
26
35
  eventName: params.eventName
27
36
  };
@@ -1 +1 @@
1
- {"version":3,"names":["EventBus","Map","params","eventMap","set","eventName"],"sources":["../../../src/module/eventBus/index.ts"],"sourcesContent":["/**\n * notes: 区别于前端概念,3端统一API特定\n */\n\nclass EventBus {\n eventMap: Map<string, boolean> = new Map()\n\n constructor() {}\n\n /**\n * open event\n * @param params\n */\n on(params: { eventName: string; entityId?: string }) {\n this.eventMap.set(`${params.eventName}`, true)\n\n return {\n eventName: params.eventName,\n }\n }\n\n off(params: { eventName: string; entityId?: string }) {\n this.eventMap.set(`${params.eventName}`, false)\n\n return {\n eventName: params.eventName,\n }\n }\n}\n\nexport default EventBus"],"mappings":";;;;;;;AAAA;AACA;AACA;AAFA,IAIMA,QAAQ;EAGZ,oBAAc;IAAA;IAAA,kCAFmB,IAAIC,GAAG,EAAE;EAE3B;;EAEf;AACF;AACA;AACA;EAHE;IAAA;IAAA,OAIA,YAAGC,MAAgD,EAAE;MACnD,IAAI,CAACC,QAAQ,CAACC,GAAG,WAAIF,MAAM,CAACG,SAAS,GAAI,IAAI,CAAC;MAE9C,OAAO;QACLA,SAAS,EAAEH,MAAM,CAACG;MACpB,CAAC;IACH;EAAC;IAAA;IAAA,OAED,aAAIH,MAAgD,EAAE;MACpD,IAAI,CAACC,QAAQ,CAACC,GAAG,WAAIF,MAAM,CAACG,SAAS,GAAI,KAAK,CAAC;MAE/C,OAAO;QACLA,SAAS,EAAEH,MAAM,CAACG;MACpB,CAAC;IACH;EAAC;EAAA;AAAA;AAGH,eAAeL,QAAQ"}
1
+ {"version":3,"names":["EventBus","app","Map","params","eventMap","set","eventName","id","entity","registerEvents"],"sources":["../../../src/module/eventBus/index.ts"],"sourcesContent":["import type { BaseModule } from '../../utils/abstract'\nimport type Anov3D from '../../sdkEntry'\n\n/**\n * notes: 区别于前端概念,3端统一API特定\n */\n\nclass EventBus implements BaseModule {\n eventMap: Map<string, boolean> = new Map()\n app: Anov3D\n\n constructor(app: Anov3D) {\n this.app = app\n }\n\n /**\n * open event\n * @param params\n */\n on(params: { eventName: string; id?: string }) {\n this.eventMap.set(`${params.eventName}`, true)\n\n if (params.id && params.eventName === 'click') {\n // @ts-ignore\n this.app.entity.registerEvents({\n eventName: params.eventName,\n id: params.id,\n })\n }\n\n return {\n eventName: params.eventName,\n }\n }\n\n off(params: { eventName: string; entityId?: string }) {\n this.eventMap.set(`${params.eventName}`, false)\n\n return {\n eventName: params.eventName,\n }\n }\n}\n\nexport default EventBus"],"mappings":";;;;;;;AAGA;AACA;AACA;AAFA,IAIMA,QAAQ;EAIZ,kBAAYC,GAAW,EAAE;IAAA;IAAA,kCAHQ,IAAIC,GAAG,EAAE;IAAA;IAIxC,IAAI,CAACD,GAAG,GAAGA,GAAG;EAChB;;EAEA;AACF;AACA;AACA;EAHE;IAAA;IAAA,OAIA,YAAGE,MAA0C,EAAE;MAC7C,IAAI,CAACC,QAAQ,CAACC,GAAG,WAAIF,MAAM,CAACG,SAAS,GAAI,IAAI,CAAC;MAE9C,IAAIH,MAAM,CAACI,EAAE,IAAIJ,MAAM,CAACG,SAAS,KAAK,OAAO,EAAE;QAC7C;QACA,IAAI,CAACL,GAAG,CAACO,MAAM,CAACC,cAAc,CAAC;UAC7BH,SAAS,EAAEH,MAAM,CAACG,SAAS;UAC3BC,EAAE,EAAEJ,MAAM,CAACI;QACb,CAAC,CAAC;MACJ;MAEA,OAAO;QACLD,SAAS,EAAEH,MAAM,CAACG;MACpB,CAAC;IACH;EAAC;IAAA;IAAA,OAED,aAAIH,MAAgD,EAAE;MACpD,IAAI,CAACC,QAAQ,CAACC,GAAG,WAAIF,MAAM,CAACG,SAAS,GAAI,KAAK,CAAC;MAE/C,OAAO;QACLA,SAAS,EAAEH,MAAM,CAACG;MACpB,CAAC;IACH;EAAC;EAAA;AAAA;AAGH,eAAeN,QAAQ"}
@@ -30,29 +30,49 @@ export var Scene = /*#__PURE__*/function () {
30
30
  Object.assign(_this.opt, opt || {}, {
31
31
  onGrowInitCompleted: function onGrowInitCompleted() {
32
32
  console.log('------:onGrowInitCompleted');
33
- sendToMessage(MessageType.Event, 'onGrowInitCompleted', EMessageStatus.Success);
33
+ sendToMessage({
34
+ messageName: 'onGrowInitCompleted',
35
+ messageType: MessageType.Event,
36
+ status: EMessageStatus.Success
37
+ });
34
38
  },
35
39
  onGrowInStart: function onGrowInStart() {
36
40
  console.log('------:onGrowInStart');
37
41
 
38
42
  // opt.onGrowInStart && opt.onGrowInStart()
39
- sendToMessage(MessageType.Event, 'onGrowInStart', EMessageStatus.Success);
43
+ sendToMessage({
44
+ messageName: 'onGrowInStart',
45
+ messageType: MessageType.Event,
46
+ status: EMessageStatus.Success
47
+ });
40
48
  },
41
49
  onGrowInCompleted: function onGrowInCompleted() {
42
50
  console.log('------:onGrowInCompleted');
43
51
 
44
52
  // opt.onGrowInCompleted && opt.onGrowInCompleted()
45
- sendToMessage(MessageType.Event, 'onGrowInCompleted', EMessageStatus.Success);
53
+ sendToMessage({
54
+ messageName: 'onGrowInCompleted',
55
+ messageType: MessageType.Event,
56
+ status: EMessageStatus.Success
57
+ });
46
58
  },
47
59
  onGrowOutStart: function onGrowOutStart() {
48
60
  // opt.onGrowOutStart && opt.onGrowOutStart()
49
61
  console.log('------:onGrowOutStart');
50
- sendToMessage(MessageType.Event, 'onGrowOutStart', EMessageStatus.Success);
62
+ sendToMessage({
63
+ messageName: 'onGrowOutStart',
64
+ messageType: MessageType.Event,
65
+ status: EMessageStatus.Success
66
+ });
51
67
  },
52
68
  onGrowOutCompleted: function onGrowOutCompleted() {
53
69
  // opt.onGrowOutCompleted && opt.onGrowOutCompleted()
54
70
  console.log('------:onGrowOutCompleted');
55
- sendToMessage(MessageType.Event, 'onGrowOutCompleted', EMessageStatus.Success);
71
+ sendToMessage({
72
+ messageName: 'onGrowOutCompleted',
73
+ messageType: MessageType.Event,
74
+ status: EMessageStatus.Success
75
+ });
56
76
  }
57
77
  });
58
78
  _this.grow = new Grow(_this.opt);