use of com.helospark.tactview.core.timeline.TimelineChannel in project tactview by helospark.
the class FakeUi method dragFileToTimeline.
public TimelineClip dragFileToTimeline(File testFile, TimelinePosition position) {
TimelineChannel channel = timelineManagerAccessor.getChannels().get(0);
AddClipRequest request = AddClipRequest.builder().withChannelId(channel.getId()).withFilePath(testFile.getAbsolutePath()).withPosition(position).build();
return timelineManagerAccessor.addClip(request);
}
use of com.helospark.tactview.core.timeline.TimelineChannel in project tactview by helospark.
the class FakeUi method dragProceduralClipToChannel.
public TimelineClip dragProceduralClipToChannel(String proceduralClipId, TimelinePosition position, int channelIndex) {
TimelineChannel channel = timelineManagerAccessor.getChannels().get(channelIndex);
AddClipRequest request = AddClipRequest.builder().withChannelId(channel.getId()).withFilePath(null).withPosition(position).withProceduralClipId(proceduralClipId).build();
return timelineManagerAccessor.addClip(request);
}
use of com.helospark.tactview.core.timeline.TimelineChannel in project tactview by helospark.
the class ChannelContextMenuAppender method selectClipsInTabsMenuItem.
private MenuItem selectClipsInTabsMenuItem(String channelId) {
MenuItem menuItem = new MenuItem("Select clips on channel");
menuItem.setOnAction(e -> {
Optional<TimelineChannel> currentChannelIndex = timelineManager.findChannelWithId(channelId);
if (currentChannelIndex.isPresent()) {
selectedNodeRepository.clearAllSelectedItems();
selectedNodeRepository.addSelectedClips(currentChannelIndex.get().getAllClipId());
}
});
return menuItem;
}
use of com.helospark.tactview.core.timeline.TimelineChannel in project tactview by helospark.
the class TimelineCanvasOnDragOverHandler method getInsertBefore.
private Optional<TimelineClip> getInsertBefore(TimelineCanvasOnDragOverHandlerRequest request, String channelId) {
if (!request.selectedElement.isPresent()) {
return Optional.empty();
}
if (!request.selectedElement.get().elementType.equals(TimelineUiCacheType.CLIP)) {
return Optional.empty();
}
if (!request.channel.isPresent()) {
return Optional.empty();
}
String currentlyDraggedClipId = dragRepository.currentlyDraggedClip().getClipIds().get(0);
Optional<TimelineChannel> optionalChannelForClip = timelineAccessor.findChannelForClipId(currentlyDraggedClipId);
if (!optionalChannelForClip.isPresent()) {
return Optional.empty();
}
TimelineChannel timelineChannel = optionalChannelForClip.get();
if (!(request.channel.isPresent() && timelineChannel.getId().equals(channelId))) {
return Optional.empty();
}
for (var clip : request.channel.get().getAllClips()) {
if (selectedNodeRepository.getSelectedClipIds().contains(clip.getId())) {
continue;
}
if (dragRepository.currentlyDraggedClip().getClipIds().contains(clip.getId())) {
continue;
}
if (Math.abs(timelineState.secondsToPixelsWidthZoomAndTranslate(clip.getInterval().getStartPosition()) - request.getEventX()) < 10) {
return Optional.ofNullable(clip);
}
}
return Optional.empty();
}
use of com.helospark.tactview.core.timeline.TimelineChannel in project tactview by helospark.
the class TimelineCanvas method getChannelsHeights.
public List<ChannelHeightResponse> getChannelsHeights() {
List<ChannelHeightResponse> result = new ArrayList<>();
double channelStartY = TIMELINE_TIMESCALE_HEIGHT + CHANNEL_PADDING;
for (int i = 0; i < timelineAccessor.getChannels().size(); ++i) {
TimelineChannel currentChannel = timelineAccessor.getChannels().get(i);
double clipHeight = calculateHeight(currentChannel) + CHANNEL_PADDING * 2;
double top = channelStartY;
double bottom = channelStartY + clipHeight;
result.add(new ChannelHeightResponse(top, bottom, currentChannel));
channelStartY += clipHeight;
}
return result;
}
Aggregations