spaceLayer.js 1.4 KB

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