Skip to content

[Graf] rewrite main ExecuteEvent methods - #23484

Open
linev wants to merge 17 commits into
root-project:masterfrom
linev:pad_interactive_next
Open

linev wants to merge 17 commits into
root-project:masterfrom
linev:pad_interactive_next

Conversation

@linev

@linev linev commented Sep 24, 2026 •

Copy link
Copy Markdown
Member

Using new interactive functionality of TPad, one can simplify logic of many ExecuteEvent methods:

  • remove static variables
  • remove direct usage of TVirtualPadPainter (XOR operations)

Use TBoxInteractive for more classes, introduce TLineInteractive for several use-cases

Redesign interactivity and painting in TPie class. Fully avoid global and static variables,
do not rely on sequence of calls for ExecuteEvent or DistanceToPrimitive.

Adjust interactivity in THistPainter for zooming - also use new functionality there.

Now all classes in graf2d/graf will use new interactivity logic.

@linev
linev requested a review from silverweed September 24, 2026 13:44
@linev linev self-assigned this Sep 24, 2026
@linev
linev marked this pull request as draft September 24, 2026 13:44
@github-actions

github-actions Bot commented Sep 25, 2026 •

Copy link
Copy Markdown

Test Results

    24 files      24 suites   4d 0h 6m 24s ⏱️
 3 867 tests  3 864 ✅ 0 💤 3 ❌
83 712 runs  83 708 ✅ 0 💤 4 ❌

For more details on these failures, see this check.

Results for commit b81948f.

♻️ This comment has been updated with latest results.

@linev
linev force-pushed the pad_interactive_next branch 2 times, most recently from 776886c to 21bf660 Compare September 28, 2026 14:27
@linev linev changed the title [gpad] rewrite main ExecuteEvent methods [Graf] rewrite main ExecuteEvent methods Sep 28, 2026
@linev
linev marked this pull request as ready for review September 28, 2026 14:35
@linev
linev force-pushed the pad_interactive_next branch from 21bf660 to 8f5a118 Compare September 28, 2026 14:39
@linev
linev requested a review from dpiparo as a code owner September 28, 2026 15:16

@jblomer jblomer left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! LGTM.

Comment thread hist/histpainter/src/THistPainter.cxx
}

if (abs(px1 - px) + abs(py1 - py) < kMaxDiff) {
selectPoint = 1;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should use an enum for the bitmask

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is protected member and not leaked outside.
Code will be more tricky if I only can use mask operations.

Comment thread graf2d/graf/src/TPie.cxx Outdated
Comment thread graf2d/graf/src/TPie.cxx
Comment thread graf2d/graf/src/TPolyLine.cxx Outdated
Comment thread graf2d/graf/src/TPie.cxx
In GL case do Flush only if there are any reasons for that.
And in TPad::IsAnyNeedRepaint() method take into account only new draw actions,
stored XOR actions are not relevant for repaint
Instead adding temporary zoombox to list of primitives just
draw interactive box on the pad - which can be rectangle or filled box.
Use TPad::Interactive to store interim data for that.

Tested on all platforms: gVirtualX, GL, Qt6Canvas
Use TPad::Interactive() to store all necessary intermediate values
In non-opaque mode use direct gPad painting without complex logic as before.
Fully avoid use of static variables now
Use for event handling in TLine and TCurlyLine
Partially reuse logic from TEllipse where similar code is used.
Avoid static methods usage, use new interactive painting
No need to handle XOR operations via painter,
just use "i" paint options
Used for XOR painting of pie chart outline during moving. Now TPad method can be used which simplify drawing
Was using global pointers too much,
therefore need fully redesign event loop
Use TPad::Interactive and direct TPad::PaintPolyLine with "i" option
To change line attributes in painting one
better use TAttLine::ModifyOn() method
Fully avoid usage of global and static variables which
are not guarantee to be set correctly. Old functionality was highly depend
from call to DistanceToPrimitive. So one cannot be sure if global variables
were set correctly.

Instead use new `TPad::Interactive()` functionality
and store all interim values there.
provide TPie::GetSumOfEntriesValues() method to be able caclualte sum of all entries.
It is used in different places for angles caclulations and for printouts
Instead keeping up-to-date internal array of slices angles just calculate it every time when necessary.

Simplifies complete logic around events handling and painting of TPie
Implement better TPieSlice::DistanceToPrimitive
It returns 0 if wider part of slice is selected
Allows to activate context menu for the slice correctly.

At the same correctly redirect event execution from TPieSlice to TPie where all sectors/slices handled
Most of calculation are uses this therefore convert to it
There are minimal rounding changes after redesign of TPie
@linev
linev force-pushed the pad_interactive_next branch from 0db264f to b81948f Compare September 30, 2026 16:21

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants