Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Various improvements on JS backend #150

Merged
merged 6 commits into from
Jun 13, 2024
Merged

Conversation

Keryan-dev
Copy link
Collaborator

Main changes are:

  • Responsive resizing of the canvas along page layout (using resizeable option).
  • Option to specify target element id of canvases to be nested in the page at users will, instead of top of body.
  • Tweak to allow usual browser input reaction to go through, in particular keyboard shortcuts.

Also, disabled decorations entirely in this backend, as it doesn't fit browser/webapp UX design.

A note on restoring shortcuts : The issue was related to event default action unable to trigger unless eventListeners were set to passive. This indicates that OcamlCanvas eventListener are not terminating properly, but I was unable to understand if that was actually the case and why. I suspect it has something to do with the way Backend.run works but I can't be sure.
Either way, the proposed solution is not ideal as it will hinder the user to actually prevent default action when needed.

}

// willReadFrequently needed to avoid warning on getImageData
var ctxt = surface.getContext("2d", {willReadFrequently: true});
Copy link
Collaborator

Choose a reason for hiding this comment

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

According to the doc, this force usage of a software renderer:
https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext#willreadfrequently

@Keryan-dev Keryan-dev merged commit 4a2a70f into OCamlPro:master Jun 13, 2024
9 checks passed
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.

None yet

2 participants