@threekit-tools/treble 0.0.90-next-05 → 0.0.90-next-06

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.
@@ -90,8 +90,10 @@ export declare class SpacesState {
90
90
  private getFeature;
91
91
  private updateFeature;
92
92
  private repositionFeature;
93
- addFeature(type: IFeatureName, feature: Omit<IFeature, 'path' | 'connectedTo' | 'offset'> & {
93
+ addFeature(type: IFeatureName, feature: Pick<IFeature, 'assetId' | 'length'> & {
94
94
  offset?: number;
95
+ height?: number;
96
+ altitude?: number;
95
97
  }, addToWallIndex?: number): void;
96
98
  deleteFeature(type: IFeatureName, index: number): void;
97
99
  private getHydratedFeature;
@@ -902,7 +902,7 @@ var SpacesState = (function () {
902
902
  }
903
903
  if (index === undefined || offset === undefined)
904
904
  return;
905
- var newFeature = __assign(__assign({}, feature), { offset: offset, connectedTo: [types_2.IElements.WALL, index] });
905
+ var newFeature = __assign(__assign({}, feature), { offset: offset, height: feature.height || 0, altitude: feature.altitude || 0, connectedTo: [types_2.IElements.WALL, index], restConfiguration: '{}' });
906
906
  var newFeatureIndex;
907
907
  if ((_a = this._state[types_2.IElements.FEATURE][type]) === null || _a === void 0 ? void 0 : _a.length) {
908
908
  newFeatureIndex = this._state[types_2.IElements.FEATURE][type].length;
@@ -26,7 +26,6 @@ var FeatureAttribute;
26
26
  (function (FeatureAttribute) {
27
27
  FeatureAttribute["POSITION_X"] = "_tkSpace_offsetX";
28
28
  FeatureAttribute["POSITION_Y"] = "_tkSpace_offsetY";
29
- FeatureAttribute["POSITION_Z"] = "_tkSpace_offsetZ";
30
29
  FeatureAttribute["CONNECTED_TO"] = "_tkSpace_connectedTo";
31
30
  FeatureAttribute["FEATURE_HEIGHT"] = "_tkSpace_featureHeight";
32
31
  FeatureAttribute["FEATURE_LENGTH"] = "_tkSpace_featureWidth";
@@ -38,7 +37,6 @@ exports.attributeNameDefaults = (_a = {},
38
37
  _a[types_1.IElements.DOOR] = SpacesAttributes.DOORS,
39
38
  _a.featurePositionX = FeatureAttribute.POSITION_X,
40
39
  _a.featurePositionY = FeatureAttribute.POSITION_Y,
41
- _a.featurePositionZ = FeatureAttribute.POSITION_Z,
42
40
  _a.featureConnectedTo = FeatureAttribute.CONNECTED_TO,
43
41
  _a.featureHeight = FeatureAttribute.FEATURE_HEIGHT,
44
42
  _a.featureLength = FeatureAttribute.FEATURE_LENGTH,
@@ -2,7 +2,7 @@ import type { IWalls, ISpacesStateProps, IVerticesState, IFeatures } from './typ
2
2
  import { IUnits } from './types';
3
3
  import type { IConfiguration, IHydratedAttribute } from '../../types';
4
4
  export declare function prepAttributesIncoming(attributes: Record<string, IHydratedAttribute>, config: ISpacesStateProps): {
5
- features: IFeatures;
5
+ features: {};
6
6
  walls: IWalls;
7
7
  vertex: IVerticesState;
8
8
  };
@@ -78,6 +78,8 @@ function prepFeatureIncoming(walls, featureAttribute, config) {
78
78
  var offset = (configuration === null || configuration === void 0 ? void 0 : configuration[attributeName.featurePositionX]) / config.config.scale;
79
79
  var length = (configuration === null || configuration === void 0 ? void 0 : configuration[attributeName.featureLength]) / config.config.scale ||
80
80
  constants_1.FEATURE_LENGTH;
81
+ var height = (configuration === null || configuration === void 0 ? void 0 : configuration[attributeName.featureHeight]) / config.config.scale;
82
+ var altitude = (configuration === null || configuration === void 0 ? void 0 : configuration[attributeName.featurePositionY]) / config.config.scale;
81
83
  var connectedTo = (configuration === null || configuration === void 0 ? void 0 : configuration[attributeName.featureConnectedTo]) || '';
82
84
  var wallIndex = prepConnectionIncoming(connectedTo)[1];
83
85
  var featureLine = (0, geometry_1.getLineAtOffsetOnLineSegment)(walls[wallIndex].line, offset, length);
@@ -86,16 +88,23 @@ function prepFeatureIncoming(walls, featureAttribute, config) {
86
88
  assetId: assetId,
87
89
  offset: offset,
88
90
  length: length,
91
+ height: height,
92
+ altitude: altitude,
89
93
  path: path,
90
94
  connectedTo: [types_1.IElements.WALL, wallIndex],
95
+ restConfiguration: JSON.stringify(filterRestConfiguration(configuration, config.attributes)),
91
96
  });
92
97
  });
93
98
  return feature;
94
99
  }
95
100
  function prepAttributesIncoming(attributes, config) {
96
101
  var _a;
97
- var featuresList = [types_1.IElements.WINDOW, types_1.IElements.DOOR, types_1.IElements.OPENING];
98
102
  var wallsAndVertices = prepWallsAndVerticesIncoming(attributes[config.attributes[types_1.IElements.WALL]], config);
103
+ var featuresList = [
104
+ types_1.IElements.WINDOW,
105
+ types_1.IElements.DOOR,
106
+ types_1.IElements.OPENING,
107
+ ];
99
108
  var featuresData = featuresList.reduce(function (output, type) {
100
109
  output[type] = prepFeatureIncoming(wallsAndVertices[types_1.IElements.WALL], attributes[config.attributes[type]], config);
101
110
  return output;
@@ -107,23 +116,26 @@ function prepFeaturesOutgoing(features, config) {
107
116
  var attributeName = config.attributes;
108
117
  return features.map(function (feature) {
109
118
  var _a, _b;
110
- var assetId = feature.assetId, offset = feature.offset, length = feature.length;
119
+ var assetId = feature.assetId, offset = feature.offset, length = feature.length, height = feature.height, altitude = feature.altitude, restConfiguration = feature.restConfiguration;
111
120
  var connectedTo = prepConnectionOutgoing([
112
121
  config.attributes[feature.connectedTo[0]],
113
122
  feature.connectedTo[1],
114
123
  ]);
115
- var configuration = Object.entries((_a = {},
124
+ var configurationToScale = (_a = {},
116
125
  _a[attributeName.featureLength] = length,
117
126
  _a[attributeName.featurePositionX] = offset,
118
- _a)).reduce(function (output, _a) {
127
+ _a);
128
+ if (altitude)
129
+ configurationToScale[attributeName.featurePositionY] = altitude;
130
+ if (height)
131
+ configurationToScale[attributeName.featureHeight] = height;
132
+ var configuration = Object.entries(configurationToScale).reduce(function (output, _a) {
119
133
  var _b;
120
134
  var key = _a[0], value = _a[1];
121
135
  return Object.assign(output, (_b = {},
122
136
  _b[key] = value ? value * config.config.scale : value,
123
137
  _b));
124
- }, (_b = {},
125
- _b[attributeName.featureConnectedTo] = connectedTo,
126
- _b));
138
+ }, __assign((_b = {}, _b[attributeName.featureConnectedTo] = connectedTo, _b), JSON.parse(restConfiguration)));
127
139
  return {
128
140
  assetId: assetId,
129
141
  configuration: configuration,
@@ -56,8 +56,11 @@ export interface IFeature {
56
56
  assetId: string;
57
57
  offset: number;
58
58
  length: number;
59
+ height: number;
60
+ altitude: number;
59
61
  path?: ICoordinatesQuadrilateral;
60
62
  connectedTo: [elementType: IElements.WALL, index: number];
63
+ restConfiguration: string;
61
64
  }
62
65
  export interface IFeatureHydrated extends IFeature {
63
66
  line: ICoordinatesLine;
@@ -236,7 +239,6 @@ export interface ISpacesAttributes {
236
239
  [IElements.OPENING]: string;
237
240
  featurePositionX: string;
238
241
  featurePositionY: string;
239
- featurePositionZ: string;
240
242
  featureConnectedTo: string;
241
243
  featureHeight: string;
242
244
  featureLength: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@threekit-tools/treble",
3
- "version": "0.0.90-next-05",
3
+ "version": "0.0.90-next-06",
4
4
  "author": "Amaan Saeed",
5
5
  "license": "MIT",
6
6
  "files": [