change sensor style

master
logchan 2020-02-13 14:24:53 -05:00
parent 1c8d328dbe
commit 22b10fb750
1 changed files with 4 additions and 10 deletions

View File

@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
@ -8,6 +7,8 @@ using System.Windows.Media;
namespace chuni_hands {
internal sealed class ChuniCanvas : Canvas {
private const double SensorThickness = 4.0;
public IEnumerable<Sensor> Sensors { get; set; }
public ImageSource Image {
@ -61,15 +62,8 @@ namespace chuni_hands {
var x = paddingX + (sensor.X - sz / 2) * factor;
var y = paddingY + (sensor.Y - sz / 2) * factor;
dc.DrawRectangle(brush, null, new Rect(x, y, sz * factor, sz * factor));
/*
// draw sensor id for debug
var type = new Typeface("Microsoft YaHei");
dc.DrawText(new FormattedText(sensor.Id.ToString(),
CultureInfo.CurrentCulture, FlowDirection.LeftToRight, type, 12, Brushes.White, 96),
new Point(x, y));
*/
dc.DrawRectangle(null, new Pen(brush, SensorThickness),
new Rect(x - SensorThickness / 2, y - SensorThickness / 2, sz * factor + SensorThickness, sz * factor + SensorThickness));
}
}
}