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

ISSUE-59: Allow 100% with for all formatters and some ++candy #60

Merged
merged 35 commits into from
Feb 26, 2020

Conversation

DiegoPino
Copy link
Member

See #59

What is new?

All(well almost) formatters now support '0' width option to be used as a stub for 100% width.

The others, like some formatters that depend on Canvases (which need to have a fixed pixel size)e.g 3D one have an extra sizing functionality via JS that contracts the given canvas size in pixel to whatever is smaller (screen smaller than fixed with? We shrink to screen and redraw. Awesome!).
Also, other Formatters that totally need to have control over aspect ratio like PDF and Video allow to set '0' to force an auto height on a given fixed width. Great for avoiding squeezed video and PDFs like from 1997 when i was alive...and coding..

What else is new?

So JS improvements, like a CSS based preloader for our 3D Viewer (who wants to wait looking at a white screen for a 3D skull of 10 Mbytes to render? Not me !)

Also all Formatter summaries in the Display Mode configs reflect this many options. Either pixel X pixel, % x pixel or % by auto. Cool!

We can now render a single frame of 3D into a base64 encoded Image! Well, with some little more code (like an html div and an img src where to put that data, not really code right! We can generate on the fly thumbnails for 3D. (no iiif for that... there is no iiif for 3d, even when there are 3 x is in iiif)

I also added an extra mime type of model/obj Did you kids know Drupal8 ships with not so many useful mime types of us repo users?

I had to rebase a few times so some things could look weird. Will squash when done to cover my strange rebase (if any.. am i a good re-baser?...)

For some strange reason, this schema keys wen't this weird route. This is the first step on fixing these. Introduced in #19
Figure out what the form is really saving right?
This touches every formatter. Should not require any changes on current settings.
reacting to my lack of sleep
Will add an onresize callback after this commit. Fix to 720 px as starting point if you have 0 as width. JS will then do a full rescale to scale to pixels based on the parent container
Next step, the base64 encoded snapshot of the 3D rendering to allow a Thumbnail.
Kinda 90's but better than a white screen while the world changes
Lets try something local
Doing this directly on formatter but should on beta3 move to SBF?
Since we have defaults now and also 0 evaluates to false.
Also make width and heigth and JSON KEY required elements.
Ok, now it should be Ok again
Should i sleep or more coffee?
@DiegoPino DiegoPino added the enhancement New feature or request label Feb 26, 2020
@DiegoPino DiegoPino self-assigned this Feb 26, 2020
@giancarlobi
Copy link
Collaborator

@DiegoPino There is a strange issue, probably I'm doing something wrong. Image with Media formatter with IIIF Media and book with Page formatter with IAB when set width to 0 and height > 800 are displayed 723px x height while if I set width 1024 are displayed 1024px x height.
Are this right? I supposed if width=0 then changing height the width has to change ...

@giancarlobi
Copy link
Collaborator

@DiegoPino you can check that here: http://archipelago.byterfly.eu/node/25 http://archipelago.byterfly.eu/node/18 bith set to Maximum size: 100% x 900 pixels

@DiegoPino
Copy link
Member Author

@giancarlobi thanks for reporting this.

I just checked your site. I see right now this for the Media (openseadragon) container

<div id="iiif-field_descriptive_metadata-d81e698a-a1b5-4c85-84b2-677e990e72da-0-media1" class="strawberry-media-item field-iiif container" data-iiif-infojson="http://archipelago.byterfly.eu/iiif-server/iiif/2/53d%2Fimage-giovane-uomo-del-ballerino-che-indossa-un-salto-russo-piega-del-costume-28730977_3.jpg/info.json" data-iiif-group="iiif-field_descriptive_metadata-d81e698a-a1b5-4c85-84b2-677e990e72da-0-media" data-iiif-thumbnails="1 as:image 900 http://archipelago.byterfly.eu/iiif-server/iiif/2 http://150.145.48.51:8182/iiif/2" style="width:100%; height:900px">

And style is correctly 100% and the height 900px.
The center region where this is set is 615px width so it can only reach that width.

Maybe i'm missing something? Please let me know how this should behave to find the problem and fix it.

Just in case i momentarily disabled JS aggregation in your performance configuration and also hit manually to make sure it refreshed from any caches, so that could have been also the case, all this JS makes browsers quite hungry for caching!

Will look at a book now and report back!

Also, i just found i was issuing a getSettings (see the s!) instead of singular for the thumbnails. That is not right and was adding a lot of info to that data- property in the HTML. FIXED!
@giancarlobi
Copy link
Collaborator

@DiegoPino It's working good!!! It was my misunderstanding about how that works. As you suggested, resizing browser window ratio changes according 100% setting. Sorry and thanks.
I'll check now for PDF, I heve to ingest then check viewer 100% setting.

@DiegoPino
Copy link
Member Author

Cool. I will also ingest a 3D Model if you are OK with that =)

@giancarlobi
Copy link
Collaborator

Cool. I will also ingest a 3D Model if you are OK with that =)

Sure!!!

@giancarlobi
Copy link
Collaborator

I'll check now for PDF

@DiegoPino Also PDF works great! http://archipelago.byterfly.eu/node/29 In addition also 100% x auto is great, currently set un object linked above

@DiegoPino
Copy link
Member Author

DiegoPino commented Feb 26, 2020

@giancarlobi great! 3D model up and working =)
http://archipelago.byterfly.eu/node/30

I added an PNG image (the texture) to the ADO too. Not used right (only as thumb i guess) but we will be able to allow the 3D to load any as:images as textures too soon =)

I left the stub code there
https:/esmero/format_strawberryfield/pull/60/files#diff-1cfa2561d3f152b98602e3fc565960b4R58

Copy link
Collaborator

@giancarlobi giancarlobi left a comment

Choose a reason for hiding this comment

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

@DiegoPino also no errors in log so for me ready to merge!

@DiegoPino DiegoPino merged commit 7520388 into 8.x-1.0-beta2 Feb 26, 2020
@DiegoPino
Copy link
Member Author

@giancarlobi we made it! Great, thanks for all the testing. This will make Phone users and theming way easier. I appreciate this

@DiegoPino DiegoPino deleted the ISSUE-59 branch February 26, 2020 16:42
giancarlobi referenced this pull request in giancarlobi/format_strawberryfield Feb 26, 2020
ISSUE-59: Allow 100% with for all formatters and some ++candy (#60)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants