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

Allow to select the content of the zoomed formula #568

Open
fred-wang opened this issue Sep 10, 2013 · 8 comments
Open

Allow to select the content of the zoomed formula #568

fred-wang opened this issue Sep 10, 2013 · 8 comments

Comments

@fred-wang
Copy link
Contributor

Currently, when you click on a zoomed expression, it disappear immediately. Some users might want to select the zoomed expression (for example because it's easier to do than for the expression at normal size) so perhaps we should remove the zoom only when the user clicks outside the zoom box.

See https://bugzilla.wikimedia.org/show_bug.cgi?id=36091

@waldyrious
Copy link

+1 (as the reporter of the downstream bug report linked above)

@pkra
Copy link
Contributor

pkra commented Oct 21, 2014

Thanks for reporting this feature request upstream. This could certainly be an option in zoom extension. Pull requests are always welcome.

@waldyrious
Copy link

@pkra I'd be happy to submit a PR. Can you give me some pointers (which files should I look at, potential caveats that such a modification might entail, etc.)?

@pkra
Copy link
Contributor

pkra commented Oct 21, 2014

Cool! Thanks for your interest in helping!

The unpacked/extensions/MathMenu.js is the right place to look, or https://github.com/mathjax/MathJax/blob/master/unpacked/extensions/MathMenu.js#L262-L274 to be precise (well, a starting point anyway).

I think the tricky part is to detect a click outside the menu (IE8 should be enough but just keep it in mind that we technically still support IE6). See also http://css-tricks.com/dangers-stopping-event-propagation/.

Other than that, check https://github.com/mathjax/MathJax/wiki/Source-control-policies and https://github.com/mathjax/MathJax/blob/master/CONTRIBUTING.md.

@waldyrious
Copy link

Great, thanks! I'll take a look over the weekend.

@waldyrious
Copy link

I'm confused. Are you sure MathMenu.js is the file that I ought to be looking at? After some digging, it seems to me the fix could instead be something like replacing the three instances of mousedown by mouseup in MathZoom.js, and adding a mousemove event listener to deactivate the call to Remove untill the next mousedown.

In fact this pattern is implemented already in MathJax, because clicking a formula creates the zoomed box, but selecting it (which involves a click event, as well as a mousedown and a mouseup) doesn't make the box pop up.

@pkra
Copy link
Contributor

pkra commented Oct 27, 2014

After some digging, it seems to me the fix could instead be something like
replacing the three instances of mousedown by mouseup in MathZoom.js,

Doh! sorry about my error. Yes, MathZoom would be the right place.

In fact this pattern is implemented already in MathJax

Right. Sounds like a plan.

@waldyrious
Copy link

Cool! Do you happen to know where I can find that code, to spare me the digging? :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants