Changeset 1338


Ignore:
Timestamp:
05/06/25 23:03:14 (2 days ago)
Author:
Maciej Komosinski
Message:

NeuroProbe? signal enforcement handle now scales with font size

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpp/frams/canvas/neurodiagram.cpp

    r1216 r1338  
    484484        {
    485485                clientbordersset = 1;
    486                 setClientBorder(0, 1, 16, textHeight() + 2); // don't use textheight outside paint/mouse events
     486                setClientBorder(0, 1, textHeight(), textHeight() + 2); // don't use textheight outside paint/mouse events
    487487        }
    488488        int hold = link->n->flags & Neuro::HoldState;
     
    531531        if (chsel >= 0)
    532532        {
     533                int th = textHeight();
    533534                if (ni) state = (float)ni->getState(chsel);
    534                 yline -= textHeight();
     535                yline -= th;
    535536                int y = mapClientY(neurochart.mapData(state));
    536                 int x = size.x - 15 - 1;
     537                int x = size.x - th - 1;
    537538                drawLine(1, yline, size.x - 2, yline);
    538539                if (hold)
    539540                {
    540541                        sprintf(t, "hold: %1.3g", state);
    541                         fillRect(x, y - 1 - 5, 15, 3 + 5 + 5);
     542                        fillRect(x, y - 1 - th/2, th, 3 + th);
    542543                        setColor(255, 0, 0);
    543                         fillRect(x + 2, y - 1, 15 - 2 - 2, 3);
     544                        fillRect(x + 1 + th/8, y - 1 - th/8, th - th/4 - 2, th/4);
    544545                }
    545546                else
    546547                {
    547548                        sprintf(t, "signal: %1.3g", state);
    548                         fillRect(x, y - 1, 15, 3);
    549                 }
    550                 drawAlignedText(size.x - textHeight(), yline, 1, t);
     549                        fillRect(x, y - 1 - th/8, th, th/4 + 1);
     550                }
     551                drawAlignedText(size.x - th, yline, 1, t);
    551552        }
    552553
     
    625626        if (b & LeftButton)
    626627        {
    627                 if (x > size.x - 16)
     628                int th = textHeight();
     629                if (x > size.x - th)
    628630                {
    629631                        link->n->flags |= Neuro::HoldState;
     
    633635                        return LeftButton;
    634636                }
    635                 else if (y > size.y - 16)
     637                else if (y > size.y - th)
    636638                {
    637639                        link->n->flags ^= Neuro::HoldState;
     
    646648SString NeuroProbe::hint(int x, int y)
    647649{
    648         if ((chsel >= 0) && (x < size.x - 16) && (y > size.y - 16))
     650        int th = textHeight();
     651        if ((chsel >= 0) && (x < size.x - th) && (y > size.y - th))
    649652                return SString((link->n->flags & Neuro::HoldState) ? "Click to release" : "Click to hold");
    650653        else if (insideChSelector(x, y))
Note: See TracChangeset for help on using the changeset viewer.