diff --git a/component/layout/layout.go b/component/layout/layout.go index 92c4af7..9eeab1c 100644 --- a/component/layout/layout.go +++ b/component/layout/layout.go @@ -67,7 +67,6 @@ func (l *Layout) changeMode(m Mode) { } func (l *Layout) HandleMouseClick(x int, y int) { - l.getSelection().CommandChannel <- &data.Command{Type: runchart.CommandMoveSelection, Value: 0} l.menu.Idle() selected, i := l.findComponentAtPoint(image.Point{X: x, Y: y}) if selected == nil { @@ -302,6 +301,7 @@ func (l *Layout) Draw(buffer *ui.Buffer) { l.menu.Draw(buffer) } +// TODO extract x/y calculation to a separate method func (l *Layout) findComponentAtPoint(point image.Point) (*component.Component, int) { columnWidth := float64(l.GetRect().Dx()) / float64(columnsCount) diff --git a/component/runchart/runchart.go b/component/runchart/runchart.go index ab5fa86..e69e863 100644 --- a/component/runchart/runchart.go +++ b/component/runchart/runchart.go @@ -21,7 +21,7 @@ const ( xAxisLabelsIndent = 2 yAxisLabelsHeight = 1 yAxisLabelsIndent = 1 - historyReserveMin = 20 + historyReserveMin = 2 xBrailleMultiplier = 2 yBrailleMultiplier = 4 ) @@ -208,7 +208,8 @@ func (c *RunChart) renderLines(buffer *ui.Buffer, drawArea image.Rectangle) { selectionPoints := make(map[int]image.Point) probe := c.lines[0].points[0] - delta := ui.AbsInt(c.calculateTimeCoordinate(probe.time) - probe.coordinate) + probeCalculatedCoordinate := c.calculateTimeCoordinate(probe.time) + delta := probe.coordinate - probeCalculatedCoordinate for i, line := range c.lines {