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

Editor buttons #733

Merged
merged 5 commits into from
Feb 6, 2024
Merged

Editor buttons #733

merged 5 commits into from
Feb 6, 2024

Conversation

elalish
Copy link
Owner

@elalish elalish commented Feb 6, 2024

Follow-up to #643

Adds undo, redo, format, and share buttons to ManifoldCAD UI.

@elalish elalish requested a review from pca006132 February 6, 2024 06:27
@pca006132
Copy link
Collaborator

the buttons are currently not aligned properly, at least on firefox:

image

Adding vertical-align: middle; to .top-icon fixes it.

image

but still, the vertical alignment is still slightly off... The alignment would be perfect if the text is x, but it is not. Anyway probably not that important.

@pca006132
Copy link
Collaborator

btw, for the share functionality, we can only share gists/web pages? new script for example cannot be shared.

@elalish
Copy link
Owner Author

elalish commented Feb 6, 2024

btw, for the share functionality, we can only share gists/web pages? new script for example cannot be shared.

What do you mean? Here's a new script example from the share button: http://localhost:5173/?script=const+result+%3D+Manifold.cube%28%29%3B%0A#New%20Script%202

@pca006132
Copy link
Collaborator

Oh, sorry I overlooked that, I was creating a new empty script and look at the url. This should be fine then.

@elalish elalish merged commit dd67e99 into master Feb 6, 2024
16 checks passed
@elalish elalish deleted the editorButtons branch February 6, 2024 16:22
@elalish
Copy link
Owner Author

elalish commented Feb 6, 2024

So, I am getting "Error: URI too long" with larger shares. Apparently this is server config, so my best guess is Github pages goes with the Apache default max of 8190 characters. I can't think of a way around that, but at least this works for medium-sized scripts.

@hrgdavor
Copy link

hrgdavor commented Feb 6, 2024

I can't think of a way around that,

we implemented gzip just recently for data url hrgdavor/jscadui#76

@pca006132
Copy link
Collaborator

  1. We probably want a warning about url too long when the user click on the share button.
  2. Not sure if base64 + gzip can have very high compression ratio to worth the effort. I feel that we should add a separate button to allow script url similar to jscad.app

@elalish
Copy link
Owner Author

elalish commented Feb 6, 2024

Agreed, though didn't @hrgdavor just say that the way jscad does it is with base64+gzip? On text that might give ~10x compression, which would probably be plenty.

@hrgdavor
Copy link

hrgdavor commented Feb 6, 2024

Actually I did not explore it too much, we had an eager user that wanted to squeeze max into url, and since I already have fflate as a dependency it was a simple thing to add.

Also maybe limit is different fro server url like ?data and hash #data ... hash is not sent with the http req

@hrgdavor
Copy link

hrgdavor commented Feb 6, 2024

I just took a script from jscad examples (gears)

content size bytes size bytes urlencoded
script raw 5.320 7.906
base64 7.096 7.104
gzip&base64 2.344 2.486

I was surprised to see urlencoding original script (7.9) is more overhead than base64 and then urlencode (7.1 k)

gzip+b64 is not 10x, but looks worth it

@elalish
Copy link
Owner Author

elalish commented Feb 8, 2024

@hrgdavor Thanks for that bit about the hash not getting sent to the server. @pca006132 It looks like I was exactly wrong. So, if we switch back from query params to hashes, then it probably doesn't matter whether it's zipped or not. I'll take a look.

@elalish elalish mentioned this pull request Feb 9, 2024
cartesian-theatrics pushed a commit to SovereignShop/manifold that referenced this pull request Mar 11, 2024
* added undo, redo, format

* share button works

* cleanup

* reset scroll

* addressing feedback
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