Skip to content

feat(frontend): canvas overlay refactor - #599

Open
Rocked03 wants to merge 291 commits into
mainfrom
feat/canvas-overlay-refactor
Open

feat(frontend): canvas overlay refactor#599
Rocked03 wants to merge 291 commits into
mainfrom
feat/canvas-overlay-refactor

Conversation

@Rocked03

Copy link
Copy Markdown
Member

No description provided.

Base automatically changed from feat/canvas-paste to main May 23, 2026 07:08
@Rocked03
Rocked03 requested a review from jaskfla May 23, 2026 07:54

@jaskfla jaskfla left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Big question is: is context the right tool?

topLeftCoordinates: Point;
setImageOverlay: (overlay: ImageOverlayState | null) => void;
setShowOverlay: (show: boolean) => void;
setTopLeftCoordinates: (point: Point) => void;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
setTopLeftCoordinates: (point: Point) => void;
setOrigin: (point: Point) => void;

inset: 0,
pointerEvents: "none",
position: "absolute",
zIndex: 1,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Is z-index necessary? Can the node be rendered later in the tree instead?

}

setImageOverlay({
alt: "Preview of uploaded image",

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Can probably remove this; it’s not adding any meaning for a screen reader user


interface ImageOverlayContextType {
imageOverlay: ImageOverlayState | null;
showOverlay: boolean;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Is showOverlay is doing anything that can’t be derived from imageOverlay? Looks like showOverlay is always equivalent to imageOverlay === null by my read

null,
);
const {
setImageOverlay,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This control feels inverted. Currently: setImageOverlay is being called by a child of ImageOverlayContext. This causes a render loop that settles, which is one technical consideration; but it’s secondary to the responsibility maybe being backward

There’s only one consumer, so I’m not quite sure (admittedly from just reading the code) that it should be a context.

Tell me if this is impractical, but imageOverlay should be defined in the same component that renders ImageOverlayContext (big finger quotes around “context”), whose key should be tied to imageOverlay—and that sounds suspiciously like regular state management, not a context 🤔

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.

3 participants