コード例 #1
0
        internal static WheelEventArgs Read(JsonElement jsonElement)
        {
            var eventArgs = new WheelEventArgs();

            foreach (var property in jsonElement.EnumerateObject())
            {
                if (property.NameEquals(DeltaX.EncodedUtf8Bytes))
                {
                    eventArgs.DeltaX = property.Value.GetDouble();
                }
                else if (property.NameEquals(DeltaY.EncodedUtf8Bytes))
                {
                    eventArgs.DeltaY = property.Value.GetDouble();
                }
                else if (property.NameEquals(DeltaZ.EncodedUtf8Bytes))
                {
                    eventArgs.DeltaZ = property.Value.GetDouble();
                }
                else if (property.NameEquals(DeltaMode.EncodedUtf8Bytes))
                {
                    eventArgs.DeltaMode = property.Value.GetInt64();
                }
                else
                {
                    MouseEventArgsReader.ReadProperty(eventArgs, property);
                }
            }

            return(eventArgs);
        }
コード例 #2
0
        internal static PointerEventArgs Read(JsonElement jsonElement)
        {
            var eventArgs = new PointerEventArgs();

            foreach (var property in jsonElement.EnumerateObject())
            {
                if (property.NameEquals(PointerId.EncodedUtf8Bytes))
                {
                    eventArgs.PointerId = property.Value.GetInt64();
                }
                else if (property.NameEquals(Width.EncodedUtf8Bytes))
                {
                    eventArgs.Width = property.Value.GetSingle();
                }
                else if (property.NameEquals(Height.EncodedUtf8Bytes))
                {
                    eventArgs.Height = property.Value.GetSingle();
                }
                else if (property.NameEquals(Pressure.EncodedUtf8Bytes))
                {
                    eventArgs.Pressure = property.Value.GetSingle();
                }
                else if (property.NameEquals(TiltX.EncodedUtf8Bytes))
                {
                    eventArgs.TiltX = property.Value.GetSingle();
                }
                else if (property.NameEquals(TiltY.EncodedUtf8Bytes))
                {
                    eventArgs.TiltY = property.Value.GetSingle();
                }
                else if (property.NameEquals(PointerType.EncodedUtf8Bytes))
                {
                    eventArgs.PointerType = property.Value.GetString() !;
                }
                else if (property.NameEquals(IsPrimary.EncodedUtf8Bytes))
                {
                    eventArgs.IsPrimary = property.Value.GetBoolean();
                }
                else
                {
                    MouseEventArgsReader.ReadProperty(eventArgs, property);
                }
            }

            return(eventArgs);
        }
コード例 #3
0
        internal static DragEventArgs Read(JsonElement jsonElement)
        {
            var eventArgs = new DragEventArgs();

            foreach (var property in jsonElement.EnumerateObject())
            {
                if (property.NameEquals(DataTransfer.EncodedUtf8Bytes))
                {
                    eventArgs.DataTransfer = ReadDataTransfer(property.Value);
                }
                else
                {
                    MouseEventArgsReader.ReadProperty(eventArgs, property);
                }
            }

            return(eventArgs);
        }