private void updateInputArea() { if (tabletDriver.Tablet == null) { tablet.Value = null; return; } float inputWidth = tabletDriver.Tablet.Digitizer.Width; float inputHeight = tabletDriver.Tablet.Digitizer.Height; AreaSize.Default = new Vector2(inputWidth, inputHeight); // if it's clear the user has not configured the area, take the full area from the tablet that was just found. if (AreaSize.Value == Vector2.Zero) { AreaSize.SetDefault(); } AreaOffset.Default = new Vector2(inputWidth / 2, inputHeight / 2); // likewise with the position, use the centre point if it has not been configured. // it's safe to assume no user would set their centre point to 0,0 for now. if (AreaOffset.Value == Vector2.Zero) { AreaOffset.SetDefault(); } tablet.Value = new TabletInfo(tabletDriver.Tablet.TabletProperties.Name, AreaSize.Default); switch (tabletDriver.OutputMode) { case AbsoluteOutputMode absoluteOutputMode: { // Set input area in millimeters absoluteOutputMode.Input = new Area { Width = AreaSize.Value.X, Height = AreaSize.Value.Y, Position = new System.Numerics.Vector2(AreaOffset.Value.X, AreaOffset.Value.Y), Rotation = 0 }; break; } } }
public void SetTabletSize(Vector2 size) { tablet.Value = size != Vector2.Zero ? new TabletInfo($"test tablet T-{RNG.Next(999):000}", size) : null; AreaSize.Default = new Vector2(size.X, size.Y); // if it's clear the user has not configured the area, take the full area from the tablet that was just found. if (AreaSize.Value == Vector2.Zero) { AreaSize.SetDefault(); } AreaOffset.Default = new Vector2(size.X / 2, size.Y / 2); // likewise with the position, use the centre point if it has not been configured. // it's safe to assume no user would set their centre point to 0,0 for now. if (AreaOffset.Value == Vector2.Zero) { AreaOffset.SetDefault(); } }