mirror of
https://github.com/storytold/gridcraft.git
synced 2026-11-18 16:14:57 +00:00
#4389, #4390: drag a selected chart's data outline to change its range A selected chart now outlines its data as Excel does: series names in red, category labels in purple and the values as one blue block. The values block has a handle on each corner. Dragging one previews the new block, and the release points the chart at it as one undo step. Esc cancels. The new engine command chart.setValuesRange does the move. Each series keeps its formatting, a wider block adds series and a narrower one drops them, and names, category labels and bubble sizes that line up with the block follow it. PivotCharts and series that are not one block are refused. #4389: chart data drag review fixes - Category labels are compared as blocks, so a reference written with a leading = still counts as the same labels. - A resize keeps the orientation the series were read in, so a chart shrunk to one cell per series stays resizable. - The preview stays while edge scrolling moves the chart off screen. - A values corner hidden under frozen panes is not a handle. - The release takes the block from the pointer's last position, even when it moved in the release frame. - Esc cancels the drag with Ctrl or Cmd held too. Each fix has a test that fails without it. #4389: read a corner drag from the grabbed corner's own cell A values corner lies on a cell boundary, which belongs to the next row and column, so a press on the bottom-right corner of A1:A5 read as B6: releasing where the press was, or dragging straight down the edge of column A, changed the other axis too. The drag now records the offset from the press point to the centre of the corner's cell and reads the pointer through it, so the press point stays in its cell and each whole cell of movement moves the corner by one. #4389: snap a dragged chart data edge to the nearest gridline Reading the pointer from the middle of the grabbed corner's cell let the grabbed row's height decide when the block moved: with a tall row 5 and a short row 6, the pointer reached the bottom of row 6 while the block stayed at A1:A5. Each edge the corner moves now snaps to the gridline nearest the pointer, so every row and column changes over at its own middle. A release where the press was still changes nothing, since the corner lies on its own gridlines, and an edge dropped on its fixed edge keeps one row or column. #4389: drop a chart data drag when the chart's data changes under it A command run between frames (the control channel, a macro) could change the chart's values block while the button was held, and the release then put the dragged block over that change. The drag now checks, from the session, that the chart still plots the block it started from: a move drops a stale drag, and the release skips it.