Skip to content

Try to fix Events sheet wrong resizing of events on scroll#8551

Merged
4ian merged 3 commits into
masterfrom
try-fix-scroll-sheet
May 5, 2026
Merged

Try to fix Events sheet wrong resizing of events on scroll#8551
4ian merged 3 commits into
masterfrom
try-fix-scroll-sheet

Conversation

@ClementPasteau
Copy link
Copy Markdown
Collaborator

@ClementPasteau ClementPasteau commented Apr 29, 2026

Fix #8510

before:

Enregistrement.de.l.ecran.2026-04-29.a.17.50.22.mov

After:

Enregistrement.de.l.ecran.2026-05-05.a.10.16.05.mov

@ClementPasteau ClementPasteau requested a review from 4ian as a code owner April 29, 2026 12:35
@ClementPasteau ClementPasteau force-pushed the try-fix-scroll-sheet branch 3 times, most recently from c7a652c to 91edf56 Compare May 4, 2026 16:01
@ClementPasteau ClementPasteau force-pushed the try-fix-scroll-sheet branch from 91edf56 to 22d7e36 Compare May 5, 2026 08:15
Comment thread newIDE/app/src/EventsSheet/index.js Outdated
'BuiltinCommonInstructions::Else': e => gd.asElseEvent(e),
};

const getInstructionsListFromEvent = (
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

A while event has getWhileConditions. What's the impact, is this a problem?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

very good remark. It looks like we're giving the same IDs for conditions and whileConditions, I'll look at fixing this

const { _eventsTree: eventsTree } = this;
if (!eventsTree) return;

// Clear selection immediately alongside the history update so that stale
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Sounds good

Comment thread newIDE/app/src/EventsSheet/index.js Outdated
newEventsHistory.futureActions.length - 1
];

// Always compute eventContexts — needed for both selection and scroll.
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Not sure this comment is useful.

// which fires the version-gated useLayoutEffect below, calling recomputeRowHeights
// before the browser paints. Using requestAnimationFrame instead would defer the
// recompute to after the first paint, causing a visible frame of wrong-size slots.
const [, forceHeightRecompute] = (React.useReducer(x => x + 1, 0): [
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Use useForceUpdate which does the same

@ClementPasteau ClementPasteau force-pushed the try-fix-scroll-sheet branch from 9356243 to 79922a9 Compare May 5, 2026 12:52
Comment thread newIDE/app/src/EventsSheet/index.js Outdated
return isCondition ? 'conditions' : 'actions';
};

const getInstructionsListFromEvent = (
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Could have been a const gd::InstructionsList* GetInstructionList(const gd::String& label), re-implemented by each event.

Carefully though, C++ can't return null. If it returns a nullptr, then isNullPtr must be used to check what you got (it's not "null" in jS)

Comment thread newIDE/app/src/EventsSheet/index.js Outdated
const gd: libGDevelop = global.gd;

// Maps event types that have conditions+actions to their gd cast function.
const eventCasters: { [string]: ?(event: gdBaseEvent) => any } = {
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

These are a bit ugly in EventsSheet, see my other comment below

@4ian 4ian merged commit 2324433 into master May 5, 2026
5 checks passed
4ian pushed a commit that referenced this pull request May 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Messed up event sheet

2 participants