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

Make the help dialog draggable and resizable using jQuery UI #70

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

ssssam
Copy link
Contributor

@ssssam ssssam commented Dec 9, 2019

This is hopefully a step towards having inline docs in the hydra editor.

It adds a new dependency on jQuery UI, and it uses the .draggable() and .resizable() helpers from that library to make the modal dialog draggable and resizable. It doesn't make the dialog dockable as I didn't find any library that supports that.

After this PR, it should be simple to insert text from docs/funcs.md into the dialog, and get basic inline documentation in a draggable window.

We want the modal dialog to be draggable and resizable, but this breaks
the menu bar unless we separate them.
These are not installed using `npm`, because it's documented as not
working with Browserify:

> If you're using browserify: The UMD headers we have aren't supported
> by browserify natively, and the deamdify plugin has a blocking bug. If
> you depend on that combination, please help fix that bug!

From https://jqueryui.com/upgrade-guide/1.12/

Instead, we embed a custom version of jQuery UI 1.12.1 containing only
the 'draggable', 'resizable', and 'dialog' widgets, and we link to a
publically hosted version of jQuery.
This makes the window more useful for viewing inline documentation,
as planned in https://github.com/ojack/hydra/issues/58.
@esnho
Copy link

esnho commented Jan 25, 2020

Pleeeease! Don't add JQuery to this piece of software! :)

@ssssam
Copy link
Contributor Author

ssssam commented Jan 25, 2020

Pleeeease! Don't add JQuery to this piece of software! :)

Can you recommend a different way to make the dialogs draggable and resizable?

@esnho
Copy link

esnho commented Jan 25, 2020

First of all I'd suggest to focus on how much the synth gain in value from a single modal that can be dragged and moved around.

Then I'd evaluate how much value adds to have JQuery as dependecy just for drag a thing around. I think that this software should focus more on: code editor, rendering, new features; something more focused on its main scope like:

To talk about how to move modal around without adding new deps here are a couple of links:

There is for example a simple pen that showcase this functionality without using JQuery:
https://codepen.io/jkasun/pen/QrLjXP

Or an article that suggests how to do it:
https://medium.com/the-z/making-a-resizable-div-in-js-is-not-easy-as-you-think-bda19a1bc53d

@ssssam
Copy link
Contributor Author

ssssam commented Jan 25, 2020

First of all I'd suggest to focus on how much the synth gain in value from a single modal that can be dragged and moved around.

@ojack suggested this approach for inline documentation. See https://github.com/ojack/hydra/pull/62 for the original discussion.

Then I'd evaluate how much value adds to have JQuery as dependecy just for drag a thing around.

The upside of using a 3rd party dependency is that implementing this feature is easy, and it adds very little code that the project would need to test and maintain. One downside I can see is that it adds 84KB of code to the frontend. The frontend bundle.js is 4.3MB already though. What other downsides are there?

@ojack
Copy link
Member

ojack commented Jan 25, 2020

Hi @ssssam sorry for the delay!

I view the documentation as an integral part of the software, and working on the way the documentation is integrated with the editor is important to me. I think it is also a a place to be creative in terms of thinking of how people learn and experiment / creative forms of documenting with live and editable examples, etc.

I agree with @esnho am pretty against adding jquery for something this small. Almost all of hydra is written from scratch, except for very specific things such as the codemirror editor and regl... Jquery is a whole framework that adds a lot of overhead and specific ways of working with code. I think we should start by just making it draggable using css (personally i am not that concerned about resizable). Dockable to me is just that when it is dragged to a certain part of the screen, it snaps to fit that size.. gonna look for some examples. It might be interesting to also have the option to pop it out into its own window.

That said you make a good point about size-- i have no idea why the hydra bundle is 4.8 GB!! The app folder is only 55kb...gonna start by looking into that.

Again I am sorry for the delay in responding. I think it has been hard because I have a lot of specific ideas for many aspects of hydra, but not a lot of time to implement them. I want to have a sort of developer meeting (virtually) soon to outline more longer term ideas for hydra and start working towards them, and hope you can both be involved.

@ssssam
Copy link
Contributor Author

ssssam commented Jan 27, 2020

Hi :)

I feel like resizing the docs/help window will be pretty important, sometimes you want to focus more on the visuals, sometimes more on the docs... anyway it's all possible without jQuery, i don't have time to rewrite this PR right now, but maybe @esnho can do it :) :)

Base automatically changed from master to main February 28, 2021 13:22
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

3 participants