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
@@ -2236,8 +2236,6 @@ function relationshipOfTwoOverlappedLines2(srcLine, destLine) {
2236
2236
  };
2237
2237
  var line0 = [p1, p2].sort(comparator);
2238
2238
  var line1 = [p3, p4].sort(comparator);
2239
- var isReversedSrcLineDirection = false;
2240
- if (line0[0].x === srcLine.x2 && line0[0].y === srcLine.y2) isReversedSrcLineDirection = true;
2241
2239
  var _sort3 = [line0, line1].sort(function (lineA, lineB) {
2242
2240
  return comparator(lineA[0], lineB[0]);
2243
2241
  }),
@@ -2245,101 +2243,305 @@ function relationshipOfTwoOverlappedLines2(srcLine, destLine) {
2245
2243
  lineSX = _sort4[0],
2246
2244
  lineDX = _sort4[1];
2247
2245
  var isReversedSrcLineIdx = false;
2248
- 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;
2249
- var compare0 = comparator(lineSX[0], lineDX[0]);
2246
+ if (lineSX[0].x === line0[0].x && lineSX[0].y === line0[0].y) isReversedSrcLineIdx = false; // SX=srcLine, DX=destLine
2247
+ else if (lineSX[0].x === line1[0].x && lineSX[0].y === line1[0].y) isReversedSrcLineIdx = true; // DX=srcLine, SX=destLine
2248
+
2249
+ var compare0 = comparator(lineSX[0], lineDX[0]); // always <= 0
2250
2250
  var compare1 = comparator(lineSX[1], lineDX[0]);
2251
2251
  var compare2 = comparator(lineSX[1], lineDX[1]);
2252
- if (_export.MathUtils.fAbs(compare0) < _constants.EPSILON && _export.MathUtils.fAbs(compare2) < _constants.EPSILON) {
2253
- return {
2254
- result: _constants.OVERLAP_SAME
2255
- };
2256
- } else if (_export.MathUtils.fAbs(compare0) < _constants.EPSILON && compare2 < 0) {
2257
- // lineDX includes lineSX
2258
- if (!isReversedSrcLineIdx) {
2259
- // dest === lineDX : dest includes src
2260
- // return OVERLAP_INCLUDED; // lineSX[1] - lineDX[1]
2261
- return {
2262
- result: _constants.OVERLAP_INCLUDED
2252
+ var sp = null,
2253
+ ep = null;
2254
+ if (_export.MathUtils.fAbs(compare1) < _constants.EPSILON) {
2255
+ // SX
2256
+ // |----------|
2257
+ // DX
2258
+ // |------------|
2259
+ // link : lineSX[0] - lineDX[1]
2260
+ if (lineSX[0].x === p1.x && lineSX[0].y === p1.y || lineDX[1].x === p2.x && lineDX[1].y === p2.y) {
2261
+ sp = {
2262
+ x: lineSX[0].x,
2263
+ y: lineSX[0].y
2264
+ };
2265
+ ep = {
2266
+ x: lineDX[1].x,
2267
+ y: lineDX[1].y
2268
+ };
2269
+ } else {
2270
+ // srcLine Direction is reversed
2271
+ sp = {
2272
+ x: lineDX[1].x,
2273
+ y: lineDX[1].y
2274
+ };
2275
+ ep = {
2276
+ x: lineSX[0].x,
2277
+ y: lineSX[0].y
2263
2278
  };
2264
2279
  }
2265
- // else {
2266
- // // src includes dest
2267
- // // return OVERLAP_SOME; // lineSX[1] - lineDX[1]
2268
- // return {
2269
- // result: OVERLAP_SOME,
2270
- // trimmedSegs: {
2271
- // x1: lineSX[1].x,
2272
- // y1: lineSX[1].y,
2273
- // x2: lineDX[1].x,
2274
- // y2: lineDX[1].y
2275
- // }
2276
- // };
2277
- // }
2278
- }
2279
- if (_export.MathUtils.fAbs(compare1) < _constants.EPSILON) {
2280
- // return OVERLAP_LINK; // lineSX[1]
2281
2280
  return {
2282
2281
  result: _constants.OVERLAP_LINK,
2283
2282
  linkedLine: {
2284
- x1: isReversedSrcLineDirection ? lineDX[1].x : lineSX[0].x,
2285
- y1: isReversedSrcLineDirection ? lineDX[1].y : lineSX[0].y,
2286
- x2: isReversedSrcLineDirection ? lineSX[0].x : lineDX[1].x,
2287
- y2: isReversedSrcLineDirection ? lineSX[0].y : lineDX[1].y
2283
+ x1: sp.x,
2284
+ y1: sp.y,
2285
+ x2: ep.x,
2286
+ y2: ep.y
2288
2287
  }
2289
2288
  };
2290
2289
  } else if (compare1 < 0) {
2290
+ // SX
2291
+ // |----------|
2292
+ // DX
2293
+ // |----------|
2294
+ // none
2291
2295
  return {
2292
2296
  result: _constants.OVERLAP_NONE
2293
2297
  };
2294
- } else {
2295
- if (_export.MathUtils.fAbs(compare2) < _constants.EPSILON || compare2 > 0) {
2296
- // lineSX includes lineDX
2297
- if (isReversedSrcLineIdx) {
2298
- // dest === lineSX : dest includes src
2299
- // return OVERLAP_INCLUDED; // lineDX[0] - lineDX[1]
2298
+ } else if (_export.MathUtils.fAbs(compare0) < _constants.EPSILON && _export.MathUtils.fAbs(compare2) < _constants.EPSILON) {
2299
+ // SX
2300
+ // |----------|
2301
+ // DX
2302
+ // |----------|
2303
+ return {
2304
+ result: _constants.OVERLAP_SAME
2305
+ };
2306
+ } else if (_export.MathUtils.fAbs(compare0) < _constants.EPSILON) {
2307
+ if (compare2 < 0 && isReversedSrcLineIdx) {
2308
+ // SX
2309
+ // |---------------|
2310
+ // DX
2311
+ // |-----------------------|
2312
+ // DX includes SX, DX=srcLine, SX=destLine : sx1 - dx1
2313
+ if (lineDX[1].x === p2.x && lineDX[1].y === p2.y) {
2314
+ sp = {
2315
+ x: lineSX[1].x,
2316
+ y: lineSX[1].y
2317
+ };
2318
+ ep = {
2319
+ x: lineDX[1].x,
2320
+ y: lineDX[1].y
2321
+ };
2322
+ } else {
2323
+ // srcLine Direction is reversed
2324
+ sp = {
2325
+ x: lineDX[1].x,
2326
+ y: lineDX[1].y
2327
+ };
2328
+ ep = {
2329
+ x: lineSX[1].x,
2330
+ y: lineSX[1].y
2331
+ };
2332
+ }
2333
+ return {
2334
+ result: _constants.OVERLAP_SOME,
2335
+ trimmedSegs: [{
2336
+ x1: sp.x,
2337
+ y1: sp.y,
2338
+ x2: ep.x,
2339
+ y2: ep.y
2340
+ }]
2341
+ };
2342
+ } else if (compare2 > 0 && !isReversedSrcLineIdx) {
2343
+ // SX
2344
+ // |-----------------------|
2345
+ // DX
2346
+ // |---------------|
2347
+ // SX includes DX, SX=srcLine, DX=destLine : dx1 - sx1
2348
+ if (lineSX[1].x === p2.x && lineSX[1].y === p2.y) {
2349
+ sp = {
2350
+ x: lineDX[1].x,
2351
+ y: lineDX[1].y
2352
+ };
2353
+ ep = {
2354
+ x: lineSX[1].x,
2355
+ y: lineSX[1].y
2356
+ };
2357
+ } else {
2358
+ // srcLine Direction is reversed
2359
+ sp = {
2360
+ x: lineSX[1].x,
2361
+ y: lineSX[1].y
2362
+ };
2363
+ ep = {
2364
+ x: lineDX[1].x,
2365
+ y: lineDX[1].y
2366
+ };
2367
+ }
2368
+ return {
2369
+ result: _constants.OVERLAP_SOME,
2370
+ trimmedSegs: [{
2371
+ x1: sp.x,
2372
+ y1: sp.y,
2373
+ x2: ep.x,
2374
+ y2: ep.y
2375
+ }]
2376
+ };
2377
+ } else {
2378
+ // srcLine
2379
+ // |---------------|
2380
+ // destLine
2381
+ // |-----------------------|
2382
+ // destLine includes srcLine
2383
+ return {
2384
+ result: _constants.OVERLAP_INCLUDED
2385
+ };
2386
+ }
2387
+ } else if (_export.MathUtils.fAbs(compare2) < _constants.EPSILON) {
2388
+ // SX
2389
+ // |-----------------------|
2390
+ // DX
2391
+ // |------------------|
2392
+ if (isReversedSrcLineIdx) {
2393
+ // SX includes DX, DX=srcLine, SX=destLine
2394
+ // destLine includes srcLine
2395
+ return {
2396
+ result: _constants.OVERLAP_INCLUDED
2397
+ };
2398
+ } else {
2399
+ // SX includes DX, SX=srcLine, DX=destLine
2400
+ // srcLine incluedes destLine : sx0 - dx0
2401
+ if (lineSX[1].x === p2.x && lineSX[1].y === p2.y) {
2402
+ sp = {
2403
+ x: lineSX[0].x,
2404
+ y: lineSX[0].y
2405
+ };
2406
+ ep = {
2407
+ x: lineDX[0].x,
2408
+ y: lineDX[0].y
2409
+ };
2410
+ } else {
2411
+ // srcLine direction is reversed
2412
+ sp = {
2413
+ x: lineDX[0].x,
2414
+ y: lineDX[0].y
2415
+ };
2416
+ ep = {
2417
+ x: lineSX[0].x,
2418
+ y: lineSX[0].y
2419
+ };
2420
+ }
2421
+ return {
2422
+ result: _constants.OVERLAP_SOME,
2423
+ trimmedSegs: [{
2424
+ x1: sp.x,
2425
+ y1: sp.y,
2426
+ x2: ep.x,
2427
+ y2: ep.y
2428
+ }]
2429
+ };
2430
+ }
2431
+ } else if (compare0 < 0 && compare2 > 0) {
2432
+ // SX
2433
+ // |-----------------------|
2434
+ // DX
2435
+ // |----------------|
2436
+ if (isReversedSrcLineIdx) {
2437
+ // SX includes DX, DX=srcLine, SX=destLine
2438
+ // destLine includes srcLine
2439
+ return {
2440
+ result: _constants.OVERLAP_INCLUDED
2441
+ };
2442
+ } else {
2443
+ // SX includes DX, SX=srcLine, DX=destLine
2444
+ // srcLine incluedes destLine : sx0 - dx0, dx1 - sx1
2445
+ if (lineSX[1].x === p2.x && lineSX[1].y === p2.y) {
2300
2446
  return {
2301
- result: _constants.OVERLAP_INCLUDED
2447
+ result: _constants.OVERLAP_SOME,
2448
+ trimmedSegs: [{
2449
+ x1: lineSX[0].x,
2450
+ y1: lineSX[0].y,
2451
+ x2: lineDX[0].x,
2452
+ y2: lineDX[0].y
2453
+ }, {
2454
+ x1: lineDX[1].x,
2455
+ y1: lineDX[1].y,
2456
+ x2: lineSX[1].x,
2457
+ y2: lineSX[1].y
2458
+ }]
2302
2459
  };
2303
2460
  } else {
2304
- // dest === lineDX : src includes dest
2305
- var trimmedSegs = [];
2306
- // return OVERLAP_SOME; // lineSX[0] - lineDX[0], lineDX[1] - lineSX[1]
2307
- if (compare0 < 0) trimmedSegs.push({
2308
- x1: isReversedSrcLineDirection ? lineDX[0].x : lineSX[0].x,
2309
- y1: isReversedSrcLineDirection ? lineDX[0].y : lineSX[0].y,
2310
- x2: isReversedSrcLineDirection ? lineSX[0].x : lineDX[0].x,
2311
- y2: isReversedSrcLineDirection ? lineSX[0].y : lineDX[0].y
2312
- });
2313
- if (compare2 > 0) trimmedSegs.push({
2314
- x1: isReversedSrcLineDirection ? lineSX[1].x : lineDX[1].x,
2315
- y1: isReversedSrcLineDirection ? lineSX[1].y : lineDX[1].y,
2316
- x2: isReversedSrcLineDirection ? lineDX[1].x : lineSX[1].x,
2317
- y2: isReversedSrcLineDirection ? lineDX[1].y : lineSX[1].y
2318
- });
2461
+ // srcLine direction is reversed
2319
2462
  return {
2320
2463
  result: _constants.OVERLAP_SOME,
2321
- trimmedSegs: trimmedSegs
2464
+ trimmedSegs: [{
2465
+ x1: lineDX[0].x,
2466
+ y1: lineDX[0].y,
2467
+ x2: lineSX[0].x,
2468
+ y2: lineSX[0].y
2469
+ }, {
2470
+ x1: lineSX[1].x,
2471
+ y1: lineSX[1].y,
2472
+ x2: lineDX[1].x,
2473
+ y2: lineDX[1].y
2474
+ }]
2322
2475
  };
2323
2476
  }
2324
2477
  }
2325
- if (compare2 < 0) {
2326
- // return OVERLAP_SOME; // lineSX[0] - lineDX[0], lineSX[1] - lineDX[1]
2327
- var _trimmedSegs = [];
2328
- if (compare0 < 0 && !isReversedSrcLineIdx) _trimmedSegs.push({
2329
- x1: isReversedSrcLineDirection ? lineDX[0].x : lineSX[0].x,
2330
- y1: isReversedSrcLineDirection ? lineDX[0].y : lineSX[0].y,
2331
- x2: isReversedSrcLineDirection ? lineSX[0].x : lineDX[0].x,
2332
- y2: isReversedSrcLineDirection ? lineSX[0].y : lineDX[0].y
2333
- });
2334
- if (compare2 < 0 && isReversedSrcLineIdx) _trimmedSegs.push({
2335
- x1: isReversedSrcLineDirection ? lineDX[1].x : lineSX[1].x,
2336
- y1: isReversedSrcLineDirection ? lineDX[1].y : lineSX[1].y,
2337
- x2: isReversedSrcLineDirection ? lineSX[1].x : lineDX[1].x,
2338
- y2: isReversedSrcLineDirection ? lineSX[1].y : lineDX[1].y
2339
- });
2478
+ } else if (compare2 < 0) {
2479
+ // SX
2480
+ // |-----------------------|
2481
+ // DX
2482
+ // |----------------------------|
2483
+ // overlap some
2484
+ if (isReversedSrcLineIdx) {
2485
+ // DX=srcLine, SX=destLine
2486
+ if (lineDX[1].x === p2.x && lineDX[1].y === p2.y) {
2487
+ sp = {
2488
+ x: lineSX[1].x,
2489
+ y: lineSX[1].y
2490
+ };
2491
+ ep = {
2492
+ x: lineDX[1].x,
2493
+ y: lineDX[1].y
2494
+ };
2495
+ } else {
2496
+ // srcLine direction is reversed
2497
+ sp = {
2498
+ x: lineDX[1].x,
2499
+ y: lineDX[1].y
2500
+ };
2501
+ ep = {
2502
+ x: lineSX[1].x,
2503
+ y: lineSX[1].y
2504
+ };
2505
+ }
2506
+ return {
2507
+ result: _constants.OVERLAP_SOME,
2508
+ trimmedSegs: [{
2509
+ x1: sp.x,
2510
+ y1: sp.y,
2511
+ x2: ep.x,
2512
+ y2: ep.y
2513
+ }]
2514
+ };
2515
+ } else {
2516
+ // SX=srcLine, DX=destLine
2517
+ if (lineSX[1].x === p2.x && lineSX[1].y === p2.y) {
2518
+ sp = {
2519
+ x: lineSX[0].x,
2520
+ y: lineSX[0].y
2521
+ };
2522
+ ep = {
2523
+ x: lineDX[0].x,
2524
+ y: lineDX[0].y
2525
+ };
2526
+ } else {
2527
+ // srcLine direction is reversed
2528
+ sp = {
2529
+ x: lineDX[0].x,
2530
+ y: lineDX[0].y
2531
+ };
2532
+ ep = {
2533
+ x: lineSX[0].x,
2534
+ y: lineSX[0].y
2535
+ };
2536
+ }
2340
2537
  return {
2341
2538
  result: _constants.OVERLAP_SOME,
2342
- trimmedSegs: _trimmedSegs
2539
+ trimmedSegs: [{
2540
+ x1: sp.x,
2541
+ y1: sp.y,
2542
+ x2: ep.x,
2543
+ y2: ep.y
2544
+ }]
2343
2545
  };
2344
2546
  }
2345
2547
  }
@@ -18,7 +18,7 @@ var historyPush = exports.historyPush = function historyPush(historyStructure, i
18
18
  });
19
19
 
20
20
  // convert map to object of the [value] field
21
- if (_immutable.List.isList(toPush.get('diff')) && ((_toPush$get = toPush.get('diff')) === null || _toPush$get === void 0 ? void 0 : _toPush$get.size) > 1) {
21
+ if (_immutable.List.isList(toPush.get('diff')) && ((_toPush$get = toPush.get('diff')) === null || _toPush$get === void 0 ? void 0 : _toPush$get.size) > 0) {
22
22
  for (var i = 0; i < toPush.get('diff').size; i++) {
23
23
  var mapValue = toPush.get('diff').get(i).get('value');
24
24
  if (_immutable.Map.isMap(mapValue)) {