mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-04-18 06:13:52 +02:00
feat: Add drag/drop functionality to the screenshot viewer (#536)
* feat: Add drag/drop functionality to the screenshot viewer * feat: Add arrow key controls for screenshot carousel
This commit is contained in:
43
CefCustomDragHandler.cs
Normal file
43
CefCustomDragHandler.cs
Normal file
@@ -0,0 +1,43 @@
|
||||
using CefSharp.Enums;
|
||||
using CefSharp;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace VRCX
|
||||
{
|
||||
/// <summary>
|
||||
/// This class is used to 'handle' drag and drop events.
|
||||
/// All it does is call a function in the app with the file name of the file being dragged into the window, since chromium doesn't have access to the full file path on regular drop events.
|
||||
/// </summary>
|
||||
public class CustomDragHandler : IDragHandler
|
||||
{
|
||||
public bool OnDragEnter(IWebBrowser chromiumWebBrowser, IBrowser browser, IDragData dragData, DragOperationsMask mask)
|
||||
{
|
||||
if (dragData.IsFile && dragData.FileNames != null && dragData.FileNames.Count > 0)
|
||||
{
|
||||
string file = dragData.FileNames[0];
|
||||
if (!file.EndsWith(".png") && !file.EndsWith(".jpg") && !file.EndsWith(".jpeg"))
|
||||
{
|
||||
dragData.Dispose();
|
||||
return true;
|
||||
}
|
||||
|
||||
// forgive me father for i have sinned once again
|
||||
AppApi.Instance.ExecuteAppFunction("dragEnterCef", dragData.FileNames[0]);
|
||||
dragData.Dispose();
|
||||
return false;
|
||||
}
|
||||
|
||||
dragData.Dispose();
|
||||
return true;
|
||||
}
|
||||
|
||||
public void OnDraggableRegionsChanged(IWebBrowser chromiumWebBrowser, IBrowser browser, IFrame frame, IList<DraggableRegion> regions)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user