kitchen-simulator 4.4.6 → 5.0.0-new-api.1

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 (187) hide show
  1. package/es/LiteRenderer.js +15 -53
  2. package/es/assets/Window.hdr +2100 -0
  3. package/es/assets/img/default/maple.jpg +0 -0
  4. package/es/assets/img/default/steel.jpg +0 -0
  5. package/es/catalog/catalog.js +0 -2
  6. package/es/catalog/factories/area-factory-3d.js +0 -4
  7. package/es/catalog/holes/door-double/door_double.png +0 -0
  8. package/es/catalog/holes/door-panic/panicDoor.png +0 -0
  9. package/es/catalog/holes/door-panic-double/panicDoorDouble.png +0 -0
  10. package/es/catalog/holes/gate/gate.jpg +0 -0
  11. package/es/catalog/holes/window-clear/texture.png +0 -0
  12. package/es/catalog/holes/window-cross/texture.png +0 -0
  13. package/es/catalog/holes/window-double-hung/texture.png +0 -0
  14. package/es/catalog/holes/window-vertical/texture.png +0 -0
  15. package/es/catalog/utils/exporter.js +2 -0
  16. package/es/catalog/utils/item-loader.js +0 -4
  17. package/es/class/area.js +0 -1
  18. package/es/class/export.js +1 -3
  19. package/es/class/item.js +17 -6
  20. package/es/components/content.js +1 -3
  21. package/es/components/style/export.js +2 -28
  22. package/es/components/viewer2d/line.js +2 -2
  23. package/es/components/viewer2d/viewer2d.js +0 -1
  24. package/es/components/viewer3d/front3D.js +1 -2
  25. package/es/components/viewer3d/pointer-lock-navigation.js +0 -90
  26. package/es/components/viewer3d/scene-creator.js +0 -1
  27. package/es/components/viewer3d/three-memory-cleaner.js +0 -14
  28. package/es/components/viewer3d/viewer3d.js +1 -1
  29. package/es/constants.js +11 -6
  30. package/es/devLiteRenderer.js +124 -84
  31. package/es/mappings/external-events/mapExternalEventPayload.js +28 -0
  32. package/es/mappings/external-events/mappers/addItemMapper.js +86 -0
  33. package/es/mappings/external-events/mappers/ccdfMapper.js +86 -0
  34. package/es/mappings/external-events/mappers/ccdfToCDSMapper.js +31 -0
  35. package/es/mappings/external-events/mappers/changeDoorStyleMapper.js +37 -0
  36. package/es/mappings/external-events/mappers/loadProjectMapper.js +62 -0
  37. package/es/mappings/holesToCatalog.js +139 -0
  38. package/es/models.js +12 -1
  39. package/es/plugins/keyboard.js +1 -1
  40. package/es/reducers/export.js +2 -4
  41. package/es/reducers/items-reducer.js +1 -1
  42. package/es/reducers/project-reducer.js +1 -1
  43. package/es/reducers/reducer.js +2 -3
  44. package/es/shared/objects/immutable.js +3 -0
  45. package/es/utils/geometry.js +276 -74
  46. package/es/utils/history.js +2 -2
  47. package/es/utils/isolate-event-handler.js +57 -45
  48. package/es/utils/molding.js +5 -3
  49. package/lib/LiteRenderer.js +17 -55
  50. package/lib/assets/Window.hdr +2100 -0
  51. package/lib/assets/img/default/maple.jpg +0 -0
  52. package/lib/assets/img/default/steel.jpg +0 -0
  53. package/lib/catalog/catalog.js +0 -2
  54. package/lib/catalog/factories/area-factory-3d.js +0 -4
  55. package/lib/catalog/holes/door-double/door_double.png +0 -0
  56. package/lib/catalog/holes/door-panic/panicDoor.png +0 -0
  57. package/lib/catalog/holes/door-panic-double/panicDoorDouble.png +0 -0
  58. package/lib/catalog/holes/gate/gate.jpg +0 -0
  59. package/lib/catalog/holes/window-clear/texture.png +0 -0
  60. package/lib/catalog/holes/window-cross/texture.png +0 -0
  61. package/lib/catalog/holes/window-double-hung/texture.png +0 -0
  62. package/lib/catalog/holes/window-vertical/texture.png +0 -0
  63. package/lib/catalog/utils/exporter.js +2 -0
  64. package/lib/catalog/utils/item-loader.js +0 -4
  65. package/lib/class/area.js +0 -1
  66. package/lib/class/export.js +0 -8
  67. package/lib/class/item.js +17 -6
  68. package/lib/components/content.js +1 -3
  69. package/lib/components/style/export.js +1 -105
  70. package/lib/components/viewer2d/line.js +1 -1
  71. package/lib/components/viewer2d/viewer2d.js +0 -1
  72. package/lib/components/viewer3d/front3D.js +1 -2
  73. package/lib/components/viewer3d/pointer-lock-navigation.js +0 -90
  74. package/lib/components/viewer3d/scene-creator.js +0 -1
  75. package/lib/components/viewer3d/three-memory-cleaner.js +0 -14
  76. package/lib/constants.js +16 -11
  77. package/lib/devLiteRenderer.js +126 -86
  78. package/lib/mappings/external-events/mapExternalEventPayload.js +33 -0
  79. package/lib/mappings/external-events/mappers/addItemMapper.js +92 -0
  80. package/lib/mappings/external-events/mappers/ccdfMapper.js +93 -0
  81. package/lib/mappings/external-events/mappers/ccdfToCDSMapper.js +37 -0
  82. package/lib/mappings/external-events/mappers/changeDoorStyleMapper.js +44 -0
  83. package/lib/mappings/external-events/mappers/loadProjectMapper.js +70 -0
  84. package/lib/mappings/holesToCatalog.js +148 -0
  85. package/lib/models.js +12 -1
  86. package/lib/reducers/export.js +1 -9
  87. package/lib/reducers/reducer.js +0 -1
  88. package/lib/shared/objects/immutable.js +9 -0
  89. package/lib/utils/geometry.js +276 -74
  90. package/lib/utils/history.js +1 -1
  91. package/lib/utils/isolate-event-handler.js +57 -45
  92. package/lib/utils/molding.js +5 -3
  93. package/package.json +1 -1
  94. package/es/assets/gltf/door_closet.bin +0 -0
  95. package/es/assets/gltf/door_closet.fbx +0 -0
  96. package/es/assets/gltf/door_exterior.bin +0 -0
  97. package/es/assets/gltf/door_exterior.fbx +0 -0
  98. package/es/assets/gltf/door_interior.bin +0 -0
  99. package/es/assets/gltf/door_interior.fbx +0 -0
  100. package/es/assets/gltf/door_sliding.bin +0 -0
  101. package/es/assets/gltf/door_sliding.fbx +0 -0
  102. package/es/assets/img/png/helper/video_preview_3d.png +0 -0
  103. package/es/assets/img/png/helper/video_preview_start.png +0 -0
  104. package/es/assets/img/svg/color/Brown.svg +0 -9
  105. package/es/assets/img/svg/color/Dark.svg +0 -9
  106. package/es/assets/img/svg/color/Light.svg +0 -9
  107. package/es/assets/img/svg/color/Medium.svg +0 -9
  108. package/es/assets/img/svg/color/Unfinished.svg +0 -9
  109. package/es/catalog/lines/wall/textures/bricks-normal2.jpg +0 -0
  110. package/es/catalog/lines/wall/textures/bricks3.jpg +0 -0
  111. package/es/catalog/properties/export.js +0 -21
  112. package/es/catalog/properties/property-checkbox.js +0 -68
  113. package/es/catalog/properties/property-color.js +0 -39
  114. package/es/catalog/properties/property-enum.js +0 -50
  115. package/es/catalog/properties/property-hidden.js +0 -19
  116. package/es/catalog/properties/property-lenght-measure.js +0 -100
  117. package/es/catalog/properties/property-length-measure.js +0 -84
  118. package/es/catalog/properties/property-length-measure_hole.js +0 -100
  119. package/es/catalog/properties/property-number.js +0 -48
  120. package/es/catalog/properties/property-read-only.js +0 -26
  121. package/es/catalog/properties/property-string.js +0 -48
  122. package/es/catalog/properties/property-toggle.js +0 -39
  123. package/es/catalog/properties/shared-property-style.js +0 -14
  124. package/es/catalog/utils/FuseUtils.js +0 -79
  125. package/es/class/FuseUtils.js +0 -79
  126. package/es/components/style/button.js +0 -106
  127. package/es/components/style/cancel-button.js +0 -21
  128. package/es/components/style/content-container.js +0 -30
  129. package/es/components/style/content-title.js +0 -25
  130. package/es/components/style/delete-button.js +0 -24
  131. package/es/components/style/form-block.js +0 -20
  132. package/es/components/style/form-color-input.js +0 -26
  133. package/es/components/style/form-label.js +0 -22
  134. package/es/components/style/form-number-input_2.js +0 -200
  135. package/es/components/style/form-select.js +0 -19
  136. package/es/components/style/form-slider.js +0 -60
  137. package/es/components/style/form-text-input.js +0 -69
  138. package/es/reducers/user-reducer.js +0 -41
  139. package/es/styles/export.js +0 -5
  140. package/es/styles/tabs.css +0 -40
  141. package/lib/assets/gltf/door_closet.bin +0 -0
  142. package/lib/assets/gltf/door_closet.fbx +0 -0
  143. package/lib/assets/gltf/door_exterior.bin +0 -0
  144. package/lib/assets/gltf/door_exterior.fbx +0 -0
  145. package/lib/assets/gltf/door_interior.bin +0 -0
  146. package/lib/assets/gltf/door_interior.fbx +0 -0
  147. package/lib/assets/gltf/door_sliding.bin +0 -0
  148. package/lib/assets/gltf/door_sliding.fbx +0 -0
  149. package/lib/assets/img/png/helper/video_preview_3d.png +0 -0
  150. package/lib/assets/img/png/helper/video_preview_start.png +0 -0
  151. package/lib/assets/img/svg/color/Brown.svg +0 -9
  152. package/lib/assets/img/svg/color/Dark.svg +0 -9
  153. package/lib/assets/img/svg/color/Light.svg +0 -9
  154. package/lib/assets/img/svg/color/Medium.svg +0 -9
  155. package/lib/assets/img/svg/color/Unfinished.svg +0 -9
  156. package/lib/catalog/lines/wall/textures/bricks-normal2.jpg +0 -0
  157. package/lib/catalog/lines/wall/textures/bricks3.jpg +0 -0
  158. package/lib/catalog/properties/export.js +0 -81
  159. package/lib/catalog/properties/property-checkbox.js +0 -76
  160. package/lib/catalog/properties/property-color.js +0 -47
  161. package/lib/catalog/properties/property-enum.js +0 -58
  162. package/lib/catalog/properties/property-hidden.js +0 -27
  163. package/lib/catalog/properties/property-lenght-measure.js +0 -108
  164. package/lib/catalog/properties/property-length-measure.js +0 -92
  165. package/lib/catalog/properties/property-length-measure_hole.js +0 -108
  166. package/lib/catalog/properties/property-number.js +0 -56
  167. package/lib/catalog/properties/property-read-only.js +0 -34
  168. package/lib/catalog/properties/property-string.js +0 -56
  169. package/lib/catalog/properties/property-toggle.js +0 -47
  170. package/lib/catalog/properties/shared-property-style.js +0 -21
  171. package/lib/catalog/utils/FuseUtils.js +0 -87
  172. package/lib/class/FuseUtils.js +0 -87
  173. package/lib/components/style/button.js +0 -115
  174. package/lib/components/style/cancel-button.js +0 -29
  175. package/lib/components/style/content-container.js +0 -38
  176. package/lib/components/style/content-title.js +0 -35
  177. package/lib/components/style/delete-button.js +0 -34
  178. package/lib/components/style/form-block.js +0 -28
  179. package/lib/components/style/form-color-input.js +0 -34
  180. package/lib/components/style/form-label.js +0 -30
  181. package/lib/components/style/form-number-input_2.js +0 -209
  182. package/lib/components/style/form-select.js +0 -29
  183. package/lib/components/style/form-slider.js +0 -68
  184. package/lib/components/style/form-text-input.js +0 -78
  185. package/lib/reducers/user-reducer.js +0 -48
  186. package/lib/styles/export.js +0 -13
  187. package/lib/styles/tabs.css +0 -40
@@ -2132,8 +2132,6 @@ export function relationshipOfTwoOverlappedLines2(srcLine, destLine) {
2132
2132
  };
2133
2133
  var line0 = [p1, p2].sort(comparator);
2134
2134
  var line1 = [p3, p4].sort(comparator);
2135
- var isReversedSrcLineDirection = false;
2136
- if (line0[0].x === srcLine.x2 && line0[0].y === srcLine.y2) isReversedSrcLineDirection = true;
2137
2135
  var _sort3 = [line0, line1].sort(function (lineA, lineB) {
2138
2136
  return comparator(lineA[0], lineB[0]);
2139
2137
  }),
@@ -2141,101 +2139,305 @@ export function relationshipOfTwoOverlappedLines2(srcLine, destLine) {
2141
2139
  lineSX = _sort4[0],
2142
2140
  lineDX = _sort4[1];
2143
2141
  var isReversedSrcLineIdx = false;
2144
- if (lineSX[0].x === line0[0].x && lineSX[0].y === line0[0].y) isReversedSrcLineIdx = false;else if (lineSX[0].x === line1[0].x && lineSX[0].y === line1[0].y) isReversedSrcLineIdx = true;
2145
- var compare0 = comparator(lineSX[0], lineDX[0]);
2142
+ if (lineSX[0].x === line0[0].x && lineSX[0].y === line0[0].y) isReversedSrcLineIdx = false; // SX=srcLine, DX=destLine
2143
+ else if (lineSX[0].x === line1[0].x && lineSX[0].y === line1[0].y) isReversedSrcLineIdx = true; // DX=srcLine, SX=destLine
2144
+
2145
+ var compare0 = comparator(lineSX[0], lineDX[0]); // always <= 0
2146
2146
  var compare1 = comparator(lineSX[1], lineDX[0]);
2147
2147
  var compare2 = comparator(lineSX[1], lineDX[1]);
2148
- if (MathUtils.fAbs(compare0) < EPSILON && MathUtils.fAbs(compare2) < EPSILON) {
2149
- return {
2150
- result: OVERLAP_SAME
2151
- };
2152
- } else if (MathUtils.fAbs(compare0) < EPSILON && compare2 < 0) {
2153
- // lineDX includes lineSX
2154
- if (!isReversedSrcLineIdx) {
2155
- // dest === lineDX : dest includes src
2156
- // return OVERLAP_INCLUDED; // lineSX[1] - lineDX[1]
2157
- return {
2158
- result: OVERLAP_INCLUDED
2148
+ var sp = null,
2149
+ ep = null;
2150
+ if (MathUtils.fAbs(compare1) < EPSILON) {
2151
+ // SX
2152
+ // |----------|
2153
+ // DX
2154
+ // |------------|
2155
+ // link : lineSX[0] - lineDX[1]
2156
+ if (lineSX[0].x === p1.x && lineSX[0].y === p1.y || lineDX[1].x === p2.x && lineDX[1].y === p2.y) {
2157
+ sp = {
2158
+ x: lineSX[0].x,
2159
+ y: lineSX[0].y
2160
+ };
2161
+ ep = {
2162
+ x: lineDX[1].x,
2163
+ y: lineDX[1].y
2164
+ };
2165
+ } else {
2166
+ // srcLine Direction is reversed
2167
+ sp = {
2168
+ x: lineDX[1].x,
2169
+ y: lineDX[1].y
2170
+ };
2171
+ ep = {
2172
+ x: lineSX[0].x,
2173
+ y: lineSX[0].y
2159
2174
  };
2160
2175
  }
2161
- // else {
2162
- // // src includes dest
2163
- // // return OVERLAP_SOME; // lineSX[1] - lineDX[1]
2164
- // return {
2165
- // result: OVERLAP_SOME,
2166
- // trimmedSegs: {
2167
- // x1: lineSX[1].x,
2168
- // y1: lineSX[1].y,
2169
- // x2: lineDX[1].x,
2170
- // y2: lineDX[1].y
2171
- // }
2172
- // };
2173
- // }
2174
- }
2175
- if (MathUtils.fAbs(compare1) < EPSILON) {
2176
- // return OVERLAP_LINK; // lineSX[1]
2177
2176
  return {
2178
2177
  result: OVERLAP_LINK,
2179
2178
  linkedLine: {
2180
- x1: isReversedSrcLineDirection ? lineDX[1].x : lineSX[0].x,
2181
- y1: isReversedSrcLineDirection ? lineDX[1].y : lineSX[0].y,
2182
- x2: isReversedSrcLineDirection ? lineSX[0].x : lineDX[1].x,
2183
- y2: isReversedSrcLineDirection ? lineSX[0].y : lineDX[1].y
2179
+ x1: sp.x,
2180
+ y1: sp.y,
2181
+ x2: ep.x,
2182
+ y2: ep.y
2184
2183
  }
2185
2184
  };
2186
2185
  } else if (compare1 < 0) {
2186
+ // SX
2187
+ // |----------|
2188
+ // DX
2189
+ // |----------|
2190
+ // none
2187
2191
  return {
2188
2192
  result: OVERLAP_NONE
2189
2193
  };
2190
- } else {
2191
- if (MathUtils.fAbs(compare2) < EPSILON || compare2 > 0) {
2192
- // lineSX includes lineDX
2193
- if (isReversedSrcLineIdx) {
2194
- // dest === lineSX : dest includes src
2195
- // return OVERLAP_INCLUDED; // lineDX[0] - lineDX[1]
2194
+ } else if (MathUtils.fAbs(compare0) < EPSILON && MathUtils.fAbs(compare2) < EPSILON) {
2195
+ // SX
2196
+ // |----------|
2197
+ // DX
2198
+ // |----------|
2199
+ return {
2200
+ result: OVERLAP_SAME
2201
+ };
2202
+ } else if (MathUtils.fAbs(compare0) < EPSILON) {
2203
+ if (compare2 < 0 && isReversedSrcLineIdx) {
2204
+ // SX
2205
+ // |---------------|
2206
+ // DX
2207
+ // |-----------------------|
2208
+ // DX includes SX, DX=srcLine, SX=destLine : sx1 - dx1
2209
+ if (lineDX[1].x === p2.x && lineDX[1].y === p2.y) {
2210
+ sp = {
2211
+ x: lineSX[1].x,
2212
+ y: lineSX[1].y
2213
+ };
2214
+ ep = {
2215
+ x: lineDX[1].x,
2216
+ y: lineDX[1].y
2217
+ };
2218
+ } else {
2219
+ // srcLine Direction is reversed
2220
+ sp = {
2221
+ x: lineDX[1].x,
2222
+ y: lineDX[1].y
2223
+ };
2224
+ ep = {
2225
+ x: lineSX[1].x,
2226
+ y: lineSX[1].y
2227
+ };
2228
+ }
2229
+ return {
2230
+ result: OVERLAP_SOME,
2231
+ trimmedSegs: [{
2232
+ x1: sp.x,
2233
+ y1: sp.y,
2234
+ x2: ep.x,
2235
+ y2: ep.y
2236
+ }]
2237
+ };
2238
+ } else if (compare2 > 0 && !isReversedSrcLineIdx) {
2239
+ // SX
2240
+ // |-----------------------|
2241
+ // DX
2242
+ // |---------------|
2243
+ // SX includes DX, SX=srcLine, DX=destLine : dx1 - sx1
2244
+ if (lineSX[1].x === p2.x && lineSX[1].y === p2.y) {
2245
+ sp = {
2246
+ x: lineDX[1].x,
2247
+ y: lineDX[1].y
2248
+ };
2249
+ ep = {
2250
+ x: lineSX[1].x,
2251
+ y: lineSX[1].y
2252
+ };
2253
+ } else {
2254
+ // srcLine Direction is reversed
2255
+ sp = {
2256
+ x: lineSX[1].x,
2257
+ y: lineSX[1].y
2258
+ };
2259
+ ep = {
2260
+ x: lineDX[1].x,
2261
+ y: lineDX[1].y
2262
+ };
2263
+ }
2264
+ return {
2265
+ result: OVERLAP_SOME,
2266
+ trimmedSegs: [{
2267
+ x1: sp.x,
2268
+ y1: sp.y,
2269
+ x2: ep.x,
2270
+ y2: ep.y
2271
+ }]
2272
+ };
2273
+ } else {
2274
+ // srcLine
2275
+ // |---------------|
2276
+ // destLine
2277
+ // |-----------------------|
2278
+ // destLine includes srcLine
2279
+ return {
2280
+ result: OVERLAP_INCLUDED
2281
+ };
2282
+ }
2283
+ } else if (MathUtils.fAbs(compare2) < EPSILON) {
2284
+ // SX
2285
+ // |-----------------------|
2286
+ // DX
2287
+ // |------------------|
2288
+ if (isReversedSrcLineIdx) {
2289
+ // SX includes DX, DX=srcLine, SX=destLine
2290
+ // destLine includes srcLine
2291
+ return {
2292
+ result: OVERLAP_INCLUDED
2293
+ };
2294
+ } else {
2295
+ // SX includes DX, SX=srcLine, DX=destLine
2296
+ // srcLine incluedes destLine : sx0 - dx0
2297
+ if (lineSX[1].x === p2.x && lineSX[1].y === p2.y) {
2298
+ sp = {
2299
+ x: lineSX[0].x,
2300
+ y: lineSX[0].y
2301
+ };
2302
+ ep = {
2303
+ x: lineDX[0].x,
2304
+ y: lineDX[0].y
2305
+ };
2306
+ } else {
2307
+ // srcLine direction is reversed
2308
+ sp = {
2309
+ x: lineDX[0].x,
2310
+ y: lineDX[0].y
2311
+ };
2312
+ ep = {
2313
+ x: lineSX[0].x,
2314
+ y: lineSX[0].y
2315
+ };
2316
+ }
2317
+ return {
2318
+ result: OVERLAP_SOME,
2319
+ trimmedSegs: [{
2320
+ x1: sp.x,
2321
+ y1: sp.y,
2322
+ x2: ep.x,
2323
+ y2: ep.y
2324
+ }]
2325
+ };
2326
+ }
2327
+ } else if (compare0 < 0 && compare2 > 0) {
2328
+ // SX
2329
+ // |-----------------------|
2330
+ // DX
2331
+ // |----------------|
2332
+ if (isReversedSrcLineIdx) {
2333
+ // SX includes DX, DX=srcLine, SX=destLine
2334
+ // destLine includes srcLine
2335
+ return {
2336
+ result: OVERLAP_INCLUDED
2337
+ };
2338
+ } else {
2339
+ // SX includes DX, SX=srcLine, DX=destLine
2340
+ // srcLine incluedes destLine : sx0 - dx0, dx1 - sx1
2341
+ if (lineSX[1].x === p2.x && lineSX[1].y === p2.y) {
2196
2342
  return {
2197
- result: OVERLAP_INCLUDED
2343
+ result: OVERLAP_SOME,
2344
+ trimmedSegs: [{
2345
+ x1: lineSX[0].x,
2346
+ y1: lineSX[0].y,
2347
+ x2: lineDX[0].x,
2348
+ y2: lineDX[0].y
2349
+ }, {
2350
+ x1: lineDX[1].x,
2351
+ y1: lineDX[1].y,
2352
+ x2: lineSX[1].x,
2353
+ y2: lineSX[1].y
2354
+ }]
2198
2355
  };
2199
2356
  } else {
2200
- // dest === lineDX : src includes dest
2201
- var trimmedSegs = [];
2202
- // return OVERLAP_SOME; // lineSX[0] - lineDX[0], lineDX[1] - lineSX[1]
2203
- if (compare0 < 0) trimmedSegs.push({
2204
- x1: isReversedSrcLineDirection ? lineDX[0].x : lineSX[0].x,
2205
- y1: isReversedSrcLineDirection ? lineDX[0].y : lineSX[0].y,
2206
- x2: isReversedSrcLineDirection ? lineSX[0].x : lineDX[0].x,
2207
- y2: isReversedSrcLineDirection ? lineSX[0].y : lineDX[0].y
2208
- });
2209
- if (compare2 > 0) trimmedSegs.push({
2210
- x1: isReversedSrcLineDirection ? lineSX[1].x : lineDX[1].x,
2211
- y1: isReversedSrcLineDirection ? lineSX[1].y : lineDX[1].y,
2212
- x2: isReversedSrcLineDirection ? lineDX[1].x : lineSX[1].x,
2213
- y2: isReversedSrcLineDirection ? lineDX[1].y : lineSX[1].y
2214
- });
2357
+ // srcLine direction is reversed
2215
2358
  return {
2216
2359
  result: OVERLAP_SOME,
2217
- trimmedSegs: trimmedSegs
2360
+ trimmedSegs: [{
2361
+ x1: lineDX[0].x,
2362
+ y1: lineDX[0].y,
2363
+ x2: lineSX[0].x,
2364
+ y2: lineSX[0].y
2365
+ }, {
2366
+ x1: lineSX[1].x,
2367
+ y1: lineSX[1].y,
2368
+ x2: lineDX[1].x,
2369
+ y2: lineDX[1].y
2370
+ }]
2218
2371
  };
2219
2372
  }
2220
2373
  }
2221
- if (compare2 < 0) {
2222
- // return OVERLAP_SOME; // lineSX[0] - lineDX[0], lineSX[1] - lineDX[1]
2223
- var _trimmedSegs = [];
2224
- if (compare0 < 0 && !isReversedSrcLineIdx) _trimmedSegs.push({
2225
- x1: isReversedSrcLineDirection ? lineDX[0].x : lineSX[0].x,
2226
- y1: isReversedSrcLineDirection ? lineDX[0].y : lineSX[0].y,
2227
- x2: isReversedSrcLineDirection ? lineSX[0].x : lineDX[0].x,
2228
- y2: isReversedSrcLineDirection ? lineSX[0].y : lineDX[0].y
2229
- });
2230
- if (compare2 < 0 && isReversedSrcLineIdx) _trimmedSegs.push({
2231
- x1: isReversedSrcLineDirection ? lineDX[1].x : lineSX[1].x,
2232
- y1: isReversedSrcLineDirection ? lineDX[1].y : lineSX[1].y,
2233
- x2: isReversedSrcLineDirection ? lineSX[1].x : lineDX[1].x,
2234
- y2: isReversedSrcLineDirection ? lineSX[1].y : lineDX[1].y
2235
- });
2374
+ } else if (compare2 < 0) {
2375
+ // SX
2376
+ // |-----------------------|
2377
+ // DX
2378
+ // |----------------------------|
2379
+ // overlap some
2380
+ if (isReversedSrcLineIdx) {
2381
+ // DX=srcLine, SX=destLine
2382
+ if (lineDX[1].x === p2.x && lineDX[1].y === p2.y) {
2383
+ sp = {
2384
+ x: lineSX[1].x,
2385
+ y: lineSX[1].y
2386
+ };
2387
+ ep = {
2388
+ x: lineDX[1].x,
2389
+ y: lineDX[1].y
2390
+ };
2391
+ } else {
2392
+ // srcLine direction is reversed
2393
+ sp = {
2394
+ x: lineDX[1].x,
2395
+ y: lineDX[1].y
2396
+ };
2397
+ ep = {
2398
+ x: lineSX[1].x,
2399
+ y: lineSX[1].y
2400
+ };
2401
+ }
2402
+ return {
2403
+ result: OVERLAP_SOME,
2404
+ trimmedSegs: [{
2405
+ x1: sp.x,
2406
+ y1: sp.y,
2407
+ x2: ep.x,
2408
+ y2: ep.y
2409
+ }]
2410
+ };
2411
+ } else {
2412
+ // SX=srcLine, DX=destLine
2413
+ if (lineSX[1].x === p2.x && lineSX[1].y === p2.y) {
2414
+ sp = {
2415
+ x: lineSX[0].x,
2416
+ y: lineSX[0].y
2417
+ };
2418
+ ep = {
2419
+ x: lineDX[0].x,
2420
+ y: lineDX[0].y
2421
+ };
2422
+ } else {
2423
+ // srcLine direction is reversed
2424
+ sp = {
2425
+ x: lineDX[0].x,
2426
+ y: lineDX[0].y
2427
+ };
2428
+ ep = {
2429
+ x: lineSX[0].x,
2430
+ y: lineSX[0].y
2431
+ };
2432
+ }
2236
2433
  return {
2237
2434
  result: OVERLAP_SOME,
2238
- trimmedSegs: _trimmedSegs
2435
+ trimmedSegs: [{
2436
+ x1: sp.x,
2437
+ y1: sp.y,
2438
+ x2: ep.x,
2439
+ y2: ep.y
2440
+ }]
2239
2441
  };
2240
2442
  }
2241
2443
  }
@@ -1,4 +1,4 @@
1
- import { List, Map } from 'immutable';
1
+ import { Map, List } from 'immutable';
2
2
  import diff from 'immutablediff';
3
3
  import patch from 'immutablepatch';
4
4
  export var historyPush = function historyPush(historyStructure, item) {
@@ -11,7 +11,7 @@ export var historyPush = function historyPush(historyStructure, item) {
11
11
  });
12
12
 
13
13
  // convert map to object of the [value] field
14
- if (List.isList(toPush.get('diff')) && ((_toPush$get = toPush.get('diff')) === null || _toPush$get === void 0 ? void 0 : _toPush$get.size) > 1) {
14
+ if (List.isList(toPush.get('diff')) && ((_toPush$get = toPush.get('diff')) === null || _toPush$get === void 0 ? void 0 : _toPush$get.size) > 0) {
15
15
  for (var i = 0; i < toPush.get('diff').size; i++) {
16
16
  var mapValue = toPush.get('diff').get(i).get('value');
17
17
  if (Map.isMap(mapValue)) {