|
@@ -1,4 +1,7 @@
|
|
|
-using PixiEditor.Models.Files;
|
|
|
+using System.Reflection;
|
|
|
+using PixiEditor.ChangeableDocument.Changeables.Graph;
|
|
|
+using PixiEditor.Models.Files;
|
|
|
+using PixiEditor.Models.Handlers;
|
|
|
using PixiEditor.Numerics;
|
|
|
|
|
|
namespace PixiEditor.Models.AnalyticsAPI;
|
|
@@ -13,6 +16,28 @@ public static class Analytics
|
|
|
|
|
|
internal static AnalyticEvent SendOpenFile(IoFileType fileType, long fileSize, VecI size) =>
|
|
|
SendEvent(AnalyticEventTypes.OpenFile, ("FileType", fileType.PrimaryExtension), ("FileSize", fileSize), ("Width", size.X), ("Height", size.Y));
|
|
|
+
|
|
|
+ internal static AnalyticEvent SendCreateNode(Type nodeType) =>
|
|
|
+ SendEvent(AnalyticEventTypes.CreateNode, ("NodeType", nodeType.GetCustomAttribute<NodeInfoAttribute>()?.UniqueName));
|
|
|
+
|
|
|
+ internal static AnalyticEvent SendCreateKeyframe(int position, string type, int fps, int duration, int totalKeyframes) =>
|
|
|
+ SendEvent(
|
|
|
+ AnalyticEventTypes.CreateKeyframe,
|
|
|
+ ("Position", position),
|
|
|
+ ("Type", type),
|
|
|
+ ("FPS", fps),
|
|
|
+ ("Duration", duration),
|
|
|
+ ("TotalKeyframes", totalKeyframes));
|
|
|
+
|
|
|
+ internal static AnalyticEvent SendCloseDocument() => SendEvent(AnalyticEventTypes.CloseDocument);
|
|
|
+
|
|
|
+ internal static AnalyticEvent SendOpenExample(string fileName) => SendEvent(AnalyticEventTypes.OpenExample, ("FileName", fileName));
|
|
|
+
|
|
|
+ internal static AnalyticEvent SendUseTool(IToolHandler? tool, VecD positionOnCanvas, VecD documentSize) =>
|
|
|
+ SendEvent(AnalyticEventTypes.UseTool, ("Tool", tool?.ToolName), ("Position", new VecD(documentSize.X / positionOnCanvas.X, documentSize.Y / positionOnCanvas.Y)));
|
|
|
+
|
|
|
+ internal static AnalyticEvent SendSwitchToTool(IToolHandler? newTool, IToolHandler? oldTool) =>
|
|
|
+ SendEvent(AnalyticEventTypes.SwitchTool, ("NewTool", newTool?.ToolName), ("OldTool", oldTool?.ToolName));
|
|
|
|
|
|
private static AnalyticEvent SendEvent(string name, params (string, object)[] data) =>
|
|
|
SendEvent(name, data.ToDictionary());
|