Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions web/libs/editor/src/regions/AudioRegion/AudioRegionModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { AudioModel } from "../../tags/object/Audio/model";
import Utils from "../../utils";
import Constants from "../../core/Constants";
import { clamp } from "../../utils/utilities";
import { FF_TIMESERIES_SYNC, isFF } from "../../utils/feature-flags";

export const AudioRegionModel = types
.model("AudioRegionModel", {
Expand Down Expand Up @@ -101,6 +102,13 @@ export const AudioRegionModel = types
self._ws_region.handleSelected(true);
self._ws_region.bringToFront();
self._ws_region.scrollToRegion();

// Emit sync event to update all synced components (TimeSeries, etc.)
if (isFF(FF_TIMESERIES_SYNC) && self.object.sync) {
const regionStartTime = self.start;
// Audio time is already in seconds, so just use it directly
self.object.syncSend({ time: regionStartTime, playing: false }, "seek");
}
},

deleteRegion() {
Expand Down
24 changes: 24 additions & 0 deletions web/libs/editor/src/regions/TimeSeriesRegion.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { guidGenerator } from "../core/Helpers";
import Registry from "../core/Registry";
import { AreaMixin } from "../mixins/AreaMixin";
import { AnnotationMixin } from "../mixins/AnnotationMixin";
import { FF_TIMESERIES_SYNC, isFF } from "../utils/feature-flags";

const hotkeys = Hotkey("TimeSeries", "Time Series Segmentation");

Expand Down Expand Up @@ -67,6 +68,29 @@ const Model = types
hotkeys.addNamed("ts:shrink-right-large", () => self.shrinkRight(lots));

self.parent.scrollToRegion(self);

// Seek to the region's start time and emit sync event to update all synced components
if (isFF(FF_TIMESERIES_SYNC) && self.parent.sync) {
const regionStartTime = self.start;

// Update cursor position to the region's start
self.parent.setCursor(regionStartTime);

// Emit sync event so all synced components (Audio, Accelerometer, etc.) seek to this time
const [minKey] = self.parent.keysRange;
if (minKey !== undefined) {
let relativeTime;
if (self.parent.isDate) {
// Convert milliseconds to seconds for sync message
relativeTime = (regionStartTime - minKey) / 1000;
} else {
// Already in seconds/indices
relativeTime = regionStartTime - minKey;
}
// Emit seek sync event
self.parent.syncSend({ time: relativeTime, playing: false }, "seek");
}
}
},

updateAppearenceFromState() {
Expand Down
2 changes: 1 addition & 1 deletion web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@
"moment": "2.29.4",
"on-headers": "1.1.0",
"form-data": "4.0.4",
"stylus": "0.0.1-security"
"stylus": "0.64.0"
},
"copyFiles": [
{
Expand Down
Loading