Content-Length: 720324 | pFad | http://github.com/ElectronNET/Electron.NET/commit/551635867d863a1c8b9cf8b2acbfe9231f0702e4

58 Replace deprecated scroll-touch-events with input-event · ElectronNET/Electron.NET@5516358 · GitHub
Skip to content

Commit 5516358

Browse files
Replace deprecated scroll-touch-events with input-event
1 parent 941b8cf commit 5516358

File tree

12 files changed

+711
-353
lines changed

12 files changed

+711
-353
lines changed

ElectronNET.API/BrowserWindow.cs

Lines changed: 0 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -702,93 +702,6 @@ public event Action<string> OnAppCommand
702702

703703
private event Action<string> _appCommand;
704704

705-
//github.com/ <summary>
706-
//github.com/ Emitted when scroll wheel event phase has begun.
707-
//github.com/ </summary>
708-
public event Action OnScrollTouchBegin
709-
{
710-
add
711-
{
712-
if (_scrollTouchBegin == null)
713-
{
714-
BridgeConnector.Socket.On("browserWindow-scroll-touch-begin" + Id, () =>
715-
{
716-
_scrollTouchBegin();
717-
});
718-
719-
BridgeConnector.Socket.Emit("register-browserWindow-scroll-touch-begin", Id);
720-
}
721-
_scrollTouchBegin += value;
722-
}
723-
remove
724-
{
725-
_scrollTouchBegin -= value;
726-
727-
if (_scrollTouchBegin == null)
728-
BridgeConnector.Socket.Off("browserWindow-scroll-touch-begin" + Id);
729-
}
730-
}
731-
732-
private event Action _scrollTouchBegin;
733-
734-
//github.com/ <summary>
735-
//github.com/ Emitted when scroll wheel event phase has ended.
736-
//github.com/ </summary>
737-
public event Action OnScrollTouchEnd
738-
{
739-
add
740-
{
741-
if (_scrollTouchEnd == null)
742-
{
743-
BridgeConnector.Socket.On("browserWindow-scroll-touch-end" + Id, () =>
744-
{
745-
_scrollTouchEnd();
746-
});
747-
748-
BridgeConnector.Socket.Emit("register-browserWindow-scroll-touch-end", Id);
749-
}
750-
_scrollTouchEnd += value;
751-
}
752-
remove
753-
{
754-
_scrollTouchEnd -= value;
755-
756-
if (_scrollTouchEnd == null)
757-
BridgeConnector.Socket.Off("browserWindow-scroll-touch-end" + Id);
758-
}
759-
}
760-
761-
private event Action _scrollTouchEnd;
762-
763-
//github.com/ <summary>
764-
//github.com/ Emitted when scroll wheel event phase filed upon reaching the edge of element.
765-
//github.com/ </summary>
766-
public event Action OnScrollTouchEdge
767-
{
768-
add
769-
{
770-
if (_scrollTouchEdge == null)
771-
{
772-
BridgeConnector.Socket.On("browserWindow-scroll-touch-edge" + Id, () =>
773-
{
774-
_scrollTouchEdge();
775-
});
776-
777-
BridgeConnector.Socket.Emit("register-browserWindow-scroll-touch-edge", Id);
778-
}
779-
_scrollTouchEdge += value;
780-
}
781-
remove
782-
{
783-
_scrollTouchEdge -= value;
784-
785-
if (_scrollTouchEdge == null)
786-
BridgeConnector.Socket.Off("browserWindow-scroll-touch-edge" + Id);
787-
}
788-
}
789-
790-
private event Action _scrollTouchEdge;
791-
792705
//github.com/ <summary>
793706
//github.com/ Emitted on 3-finger swipe. Possible directions are up, right, down, left.
794707
//github.com/ </summary>
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using ElectronNET.API.Entities;
5+
using Newtonsoft.Json;
6+
using Newtonsoft.Json.Linq;
7+
8+
namespace ElectronNET.API.Converter;
9+
10+
//github.com/ <summary>
11+
//github.com/
12+
//github.com/ </summary>
13+
public class ModifierTypeListConverter : JsonConverter<List<ModifierType>>
14+
{
15+
//github.com/ <summary>
16+
//github.com/
17+
//github.com/ </summary>
18+
//github.com/ <param name="reader"></param>
19+
//github.com/ <param name="objectType"></param>
20+
//github.com/ <param name="existingValue"></param>
21+
//github.com/ <param name="hasExistingValue"></param>
22+
//github.com/ <param name="serializer"></param>
23+
//github.com/ <returns></returns>
24+
public override List<ModifierType> ReadJson(JsonReader reader, Type objectType, List<ModifierType> existingValue, bool hasExistingValue, JsonSerializer serializer)
25+
{
26+
var token = JToken.Load(reader);
27+
28+
if (token.Type == JTokenType.Null)
29+
{
30+
return null;
31+
}
32+
33+
34+
return token.ToObject<List<string>>().Select(m => (ModifierType)Enum.Parse(typeof(ModifierType), m)).ToList();
35+
}
36+
37+
//github.com/ <summary>
38+
//github.com/
39+
//github.com/ </summary>
40+
//github.com/ <param name="writer"></param>
41+
//github.com/ <param name="value"></param>
42+
//github.com/ <param name="serializer"></param>
43+
public override void WriteJson(JsonWriter writer, List<ModifierType> value, JsonSerializer serializer)
44+
{
45+
writer.WriteStartArray();
46+
47+
foreach (var modifier in value)
48+
{
49+
writer.WriteValue(modifier.ToString());
50+
}
51+
52+
writer.WriteEndArray();
53+
}
54+
}
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
using Newtonsoft.Json.Converters;
2+
using System.Collections.Generic;
3+
using ElectronNET.API.Converter;
4+
using Newtonsoft.Json;
5+
6+
namespace ElectronNET.API.Entities
7+
{
8+
//github.com/ <summary>
9+
//github.com/
10+
//github.com/ </summary>
11+
public class InputEvent
12+
{
13+
//github.com/ <summary>
14+
//github.com/ Equivalent to KeyboardEvent.key.
15+
//github.com/ </summary>
16+
public string Key { get; set; } = "";
17+
18+
//github.com/ <summary>
19+
//github.com/ Equivalent to KeyboardEvent.code.
20+
//github.com/ </summary>
21+
public string Code { get; set; } = "";
22+
23+
//github.com/ <summary>
24+
//github.com/ Equivalent to KeyboardEvent.repeat.
25+
//github.com/ </summary>
26+
public bool IsAutoRepeat { get; set; } = false;
27+
28+
//github.com/ <summary>
29+
//github.com/ Equivalent to KeyboardEvent.isComposing.
30+
//github.com/ </summary>
31+
public bool IsComposing { get; set; } = false;
32+
33+
//github.com/ <summary>
34+
//github.com/ Equivalent to KeyboardEvent.shiftKey.
35+
//github.com/ </summary>
36+
public bool Shift { get; set; } = false;
37+
38+
//github.com/ <summary>
39+
//github.com/ Equivalent to KeyboardEvent.controlKey.
40+
//github.com/ </summary>
41+
public bool Control { get; set; } = false;
42+
43+
//github.com/ <summary>
44+
//github.com/ Equivalent to KeyboardEvent.altKey.
45+
//github.com/ </summary>
46+
public bool Alt { get; set; } = false;
47+
48+
//github.com/ <summary>
49+
//github.com/ Equivalent to KeyboardEvent.metaKey.
50+
//github.com/ </summary>
51+
public bool Meta { get; set; } = false;
52+
53+
//github.com/ <summary>
54+
//github.com/ Equivalent to KeyboardEvent.location.
55+
//github.com/ </summary>
56+
public int Location { get; set; } = 0;
57+
58+
//github.com/ <summary>
59+
//github.com/ An array of modifiers of the event, can be `shift`, `control`, `ctrl`, `alt`,
60+
//github.com/ `meta`, `command`, `cmd`, `isKeypad`, `isAutoRepeat`, `leftButtonDown`,
61+
//github.com/ `middleButtonDown`, `rightButtonDown`, `capsLock`, `numLock`, `left`, `right`
62+
//github.com/ </summary>
63+
[JsonConverter(typeof(ModifierTypeListConverter))]
64+
public List<ModifierType> Modifiers { get; set; }
65+
66+
//github.com/ <summary>
67+
//github.com/ Can be `undefined`, `mouseDown`, `mouseUp`, `mouseMove`, `mouseEnter`,
68+
//github.com/ `mouseLeave`, `contextMenu`, `mouseWheel`, `rawKeyDown`, `keyDown`, `keyUp`,
69+
//github.com/ `gestureScrollBegin`, `gestureScrollEnd`, `gestureScrollUpdate`,
70+
//github.com/ `gestureFlingStart`, `gestureFlingCancel`, `gesturePinchBegin`,
71+
//github.com/ `gesturePinchEnd`, `gesturePinchUpdate`, `gestureTapDown`, `gestureShowPress`,
72+
//github.com/ `gestureTap`, `gestureTapCancel`, `gestureShortPress`, `gestureLongPress`,
73+
//github.com/ `gestureLongTap`, `gestureTwoFingerTap`, `gestureTapUnconfirmed`,
74+
//github.com/ `gestureDoubleTap`, `touchStart`, `touchMove`, `touchEnd`, `touchCancel`,
75+
//github.com/ `touchScrollStarted`, `pointerDown`, `pointerUp`, `pointerMove`,
76+
//github.com/ `pointerRawUpdate`, `pointerCancel` or `pointerCausedUaAction`.
77+
//github.com/ </summary>
78+
[JsonConverter(typeof(StringEnumConverter))]
79+
public InputEventType Type { get; set; }
80+
}
81+
}

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/ElectronNET/Electron.NET/commit/551635867d863a1c8b9cf8b2acbfe9231f0702e4

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy