spaceLayer.js 1.5 KB

123456789101112131415161718192021222324252627282930313233
  1. "use strict";
  2. var __rest = (this && this.__rest) || function (s, e) {
  3. var t = {};
  4. for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
  5. t[p] = s[p];
  6. if (s != null && typeof Object.getOwnPropertySymbols === "function")
  7. for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
  8. if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
  9. t[p[i]] = s[p[i]];
  10. }
  11. return t;
  12. };
  13. Object.defineProperty(exports, "__esModule", { value: true });
  14. exports.SpaceLayer = void 0;
  15. const utils_1 = require("./utils");
  16. /**
  17. * @todo Propagate more options to children.
  18. */
  19. const SpaceLayer = () => {
  20. return (options) => {
  21. const { children } = options;
  22. if (!Array.isArray(children))
  23. return [];
  24. const { x: viewX = 0, y: viewY = 0, width: viewWidth, height: viewHeight, data: layerData, } = options;
  25. return children.map((_a) => {
  26. var { data, x, y, width, height } = _a, rest = __rest(_a, ["data", "x", "y", "width", "height"]);
  27. return (Object.assign(Object.assign({}, rest), { data: (0, utils_1.mergeData)(data, layerData), x: x !== null && x !== void 0 ? x : viewX, y: y !== null && y !== void 0 ? y : viewY, width: width !== null && width !== void 0 ? width : viewWidth, height: height !== null && height !== void 0 ? height : viewHeight }));
  28. });
  29. };
  30. };
  31. exports.SpaceLayer = SpaceLayer;
  32. exports.SpaceLayer.props = {};
  33. //# sourceMappingURL=spaceLayer.js.map