Skip to content

Commit

Permalink
removed all drag n drop stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
NeoCoderMatrix86 committed Dec 13, 2024
1 parent 199c42e commit 191a51e
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 113 deletions.
1 change: 0 additions & 1 deletion AudioCuesheetEditor/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@
builder.Services.AddScoped<TextImportService>();
builder.Services.AddScoped<CuesheetImportService>();
builder.Services.AddScoped<ApplicationOptionsTimeSpanParser>();
builder.Services.AddScoped<BaseComponentManager>();

builder.Services.AddLogging();
builder.Logging.AddConfiguration(builder.Configuration.GetSection("Logging"));
Expand Down
41 changes: 0 additions & 41 deletions AudioCuesheetEditor/Services/UI/BaseComponentManager.cs

This file was deleted.

1 change: 0 additions & 1 deletion AudioCuesheetEditor/Shared/TrackList/TrackList.razor
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,6 @@ along with Foobar. If not, see
<EditTrackModal @ref="modalTrackEdit" SaveClicked="() => StateHasChanged()" />

@code {
//TODO: Resizable sorgt für problem beim ziehen einer zeile über spaltenrahmen hinweg (eventuell über event ItemDragged?)
ModalDialog? modalDialog;
EditTrackModal? modalTrackEdit;
List<Track> selectedTracks = new();
Expand Down
66 changes: 1 addition & 65 deletions AudioCuesheetEditor/Shared/TrackList/TrackListItem.razor
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,13 @@ along with Foobar. If not, see
@inject ITextLocalizerService _localizationService
@inject ILocalStorageOptionsProvider _localStorageOptionsProvider
@inject ILogger<TrackListItem> _logger
@inject BaseComponentManager _baseComponentManager

<Validations @ref="validations">
@if (Cuesheet != null)
{
<Virtualize TItem="Track" Items="Cuesheet.Tracks.ToList()" Context="track" SpacerElement="tr">
<TrackLinkControl TrackReference="track" TrackSelectionVisible="TrackSelectionVisible" />
<TableRow ElementId="@GetRowElementId(track)" Color="(AudioPlayer?.CurrentlyPlayingTrack == track) ? Color.Primary : Color.Default" Draggable DragStart="() => OnDragStart(track)" DragEnter="() => OnDragEnter(track)" DragLeave="(args) => OnDragLeave(args, track)" DragOver="() => OnDragOver(track)" Drop="() => OnDrop(track)" Border="track == dragOverTrack ? Border.Is0.OnTop.Is4.Warning : null">
<TableRow Color="(AudioPlayer?.CurrentlyPlayingTrack == track) ? Color.Primary : Color.Default">
<TrackSelection Visible="TrackSelectionVisible" Selected="SelectedTracks?.Contains(track) == true" SelectedChanged="(selected) => SelectedTrackChanged(track, selected)" />
<TrackListItemControlColumn TrackReference="track" AudioPlayer="AudioPlayer" TrackDeleted="() => TrackDeleted(track)" />
<TableRowCell>
Expand Down Expand Up @@ -132,15 +131,10 @@ along with Foobar. If not, see
<EditTrackModal @ref="modalTrackEdit" SaveClicked="() => StateHasChanged()" />

@code {
//TODO: Drag border korrigieren
readonly Dictionary<Track, string> rowElementIds = new();

EditTrackModal? modalTrackEdit;
Validations? validations;
IEnumerable<MusicBrainzArtist>? autocompleteTrackArtists;
IEnumerable<MusicBrainzTrack>? autocompleteTrackTitles;
Track? draggedTrack;
Track? dragOverTrack;

public void Dispose()
{
Expand Down Expand Up @@ -304,62 +298,4 @@ along with Foobar. If not, see
{
StateHasChanged();
}

void OnDragStart(Track track)
{
_logger.LogDebug("OnDragStart: {0}", track.Position);
draggedTrack = track;
}

void OnDrop(Track track)
{
//TODO: verschieben der tracks!
_logger.LogDebug("OnDrop: {0}", track.Position);
draggedTrack = null;
dragOverTrack = null;
}

void OnDragEnter(Track track)
{
_logger.LogDebug("OnDragEnter: {0}", track.Position);
dragOverTrack = track;
}

void OnDragOver(Track track)
{
_logger.LogDebug("OnDragOver: {0}", track.Position);
dragOverTrack = track;
}

async Task OnDragLeave(DragEventArgs args, Track track)
{
_logger.LogDebug("OnDragLeave: {0}", track.Position);
var elementId = GetRowElementId(track);
var rect = await _baseComponentManager.GetBoundingClientRectAsync(elementId);
_logger.LogDebug("rect.Left: {rect.Left}, rect.Right: {rect.Right}, rect.Top: {rect.Top}, rect.Bottom: {rect.Bottom}", rect.Left, rect.Right, rect.Top, rect.Bottom);
_logger.LogDebug("args.ClientX: {args.ClientX}, args.ClientY: {args.ClientY}", args.ClientX, args.ClientY);
if (rect != null &&
args.ClientX >= rect.Left &&
args.ClientX <= rect.Right &&
args.ClientY >= rect.Top &&
args.ClientY <= rect.Bottom)
{
_logger.LogDebug("Mouse is still inside the row.");
return;
}
if (track == dragOverTrack)
{
_logger.LogDebug("track == dragOverTrack");
dragOverTrack = null;
}
}

string GetRowElementId(Track track)
{
if (!rowElementIds.ContainsKey(track))
{
rowElementIds[track] = Guid.NewGuid().ToString();
}
return rowElementIds[track];
}
}
5 changes: 0 additions & 5 deletions AudioCuesheetEditor/wwwroot/scripts/library.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,4 @@ function beforeunload(e) {

function removeBeforeunload() {
window.removeEventListener('beforeunload', beforeunload);
}

function getBoundingClientRect(domId) {
var element = document.getElementById(domId);
return element.getBoundingClientRect();
}

0 comments on commit 191a51e

Please sign in to comment.