@rig-c/review 0.18.0 → 0.19.0

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.
@@ -423,11 +423,23 @@ export function mountComparePickedTools(host: ComparePickedToolsHost): ComparePi
423
423
  }
424
424
 
425
425
  function setMode(nextMode: CommentMode, options: { fromTab?: boolean } = {}): void {
426
+ const prevMode = workspaceMode;
426
427
  workspaceMode = nextMode;
427
428
  const currentPart = host.parts()?.value();
428
429
  if (nextMode !== 'compare' && (currentPart?.side === 'a' || currentPart?.side === 'b') && currentPart.side !== pickedSide) {
429
430
  setPickedSide(currentPart.side);
430
431
  }
432
+ const modeBoundaryChanged = (prevMode === 'compare') !== (nextMode === 'compare');
433
+ if (modeBoundaryChanged) {
434
+ steppedLive = false;
435
+ applyEnvironment();
436
+ const p = currentPlayer();
437
+ if (p?.current && !host.playing()) {
438
+ p.seek(host.time());
439
+ p.draw();
440
+ host.parts()?.present(pickedSide);
441
+ }
442
+ }
431
443
  if (nextMode !== 'compare') {
432
444
  host.syncFeedbackSide(pickedSide);
433
445
  }
@@ -440,7 +452,7 @@ export function mountComparePickedTools(host: ComparePickedToolsHost): ComparePi
440
452
  }
441
453
  refreshAnimationInspection();
442
454
  inspectorBlocks?.refresh();
443
- host.redrawOverlays(false);
455
+ host.redrawOverlays(modeBoundaryChanged);
444
456
  host.saveDraft();
445
457
  }
446
458
 
@@ -908,10 +920,11 @@ export function mountComparePickedTools(host: ComparePickedToolsHost): ComparePi
908
920
  }
909
921
 
910
922
  function applyEnvironment(): void {
923
+ const active = workspaceMode !== 'compare' && environmentApplied();
911
924
  for (const s of ['a', 'b'] as const) {
912
925
  const p = host.players[s];
913
926
  if (!p) continue;
914
- if (s === pickedSide && environmentApplied()) {
927
+ if (s === pickedSide && active) {
915
928
  p.environment(environmentFor(wind.read(), gravityValue()));
916
929
  } else {
917
930
  p.environment(null);
@@ -1023,6 +1036,10 @@ export function mountComparePickedTools(host: ComparePickedToolsHost): ComparePi
1023
1036
  }
1024
1037
 
1025
1038
  function seekMode(target: number, continuing: boolean): 'settle' | 'seek' {
1039
+ if (workspaceMode === 'compare') {
1040
+ steppedLive = false;
1041
+ return 'seek';
1042
+ }
1026
1043
  const p = currentPlayer();
1027
1044
  if (!continuing && steppedLive && p && target >= p.time - 1e-9 && target - p.time <= 0.25) {
1028
1045
  steppedLive = false;
@@ -1036,7 +1053,7 @@ export function mountComparePickedTools(host: ComparePickedToolsHost): ComparePi
1036
1053
  function stepSide(mode: 'present' | 'settle' | 'seek', side: Side, target: number): void {
1037
1054
  const player = host.players[side];
1038
1055
  if (!player) return;
1039
- if (side !== pickedSide) {
1056
+ if (workspaceMode === 'compare' || side !== pickedSide) {
1040
1057
  player.environment(null);
1041
1058
  player.seek(target);
1042
1059
  return;