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

build in full-resolution image export using webgl-distort #83

Closed
jywarren opened this issue Jan 7, 2018 · 14 comments
Closed

build in full-resolution image export using webgl-distort #83

jywarren opened this issue Jan 7, 2018 · 14 comments

Comments

@jywarren
Copy link
Member

jywarren commented Jan 7, 2018

This has been marked as a good candidate for becoming a first-timers-only issue like these, meaning that it's simple, self-contained, and with some extra formatting, could be a great entry point for a new contributor. If you're familiar enough with this code, please consider reformatting or reposting it as a first-timers-only issue, and then ping @publiclab/reviewers to get it labelled. Or, if this is not your first time, try to solve it yourself!


https://github.com/jywarren/webgl-distort -- there's example code there! However, we'll need to be able to reference the original quality image -- we're currently doing this now in MapKnitter but we should build this function into this library itself, as it's a common desire:

https://github.com/publiclab/mapknitter/blob/8d94132c81b3040ae0d0b4627e685ff75275b416/app/assets/javascripts/mapknitter/Map.js#L47-L82

Making this a button in the menu would be great -- button code is here; this excerpt is a single button on the menu:

ToggleTransparency = EditOverlayAction.extend({
options: { toolbarIcon: {
html: '<span class="fa fa-adjust"></span>',
tooltip: 'Toggle Image Transparency',
title: 'Toggle Image Transparency'
}},
addHooks: function() {
var editing = this._overlay.editing;
editing._toggleTransparency();
this.disable();
}
}),

Any help much appreciated! This could be broken into several pieces for first-timers, possibly.

@jywarren jywarren changed the title build in full-resolution export using webgl-distort build in full-resolution image export using webgl-distort Jan 7, 2018
@John905
Copy link
Contributor

John905 commented Mar 20, 2018

I'll give this one a try.

@jywarren
Copy link
Member Author

jywarren commented Mar 20, 2018 via email

@John905
Copy link
Contributor

John905 commented Apr 24, 2018

Hey, I just got back to this yesterday and I'm having a problem with dependencies. I went ahead and put webgl-distort in src/edit, but even then I have to use window.webgl-distort to get Grunt to pick up the reference. Maybe one file isn't a big deal, but then there's glfx and that's quite a bit more. Should I just force it through and see what happens or am I missing something? package.json does have the dependencies for both projects but Grunt doesn't seem to see them.

@jywarren
Copy link
Member Author

Hi! Hmm, could you open up a PR so I can see exactly where you're putting things? I think we could include webgl-distort in the HTML, then rely on it being in the global namespace... but let's see!

Thank you!!!

@John905
Copy link
Contributor

John905 commented Apr 25, 2018

Another question: should warpable.rb be included or should I being snipping it out?

@jywarren
Copy link
Member Author

Hmm, from which line?

@John905
Copy link
Contributor

John905 commented Apr 25, 2018

If you look at the mapknitter code it has references to warpables - those are defined in models/warpable.rb - at least that how it appears to me. I was assuming we'd switch those for references in distortableimage.

@jywarren
Copy link
Member Author

jywarren commented Apr 25, 2018 via email

@John905
Copy link
Contributor

John905 commented May 9, 2018

Ok, I've been testing but all I get is this:
result
whether I distort it or not.
I'm expecting:
example
Any thoughts?

@jywarren
Copy link
Member Author

jywarren commented May 9, 2018 via email

@John905
Copy link
Contributor

John905 commented May 9, 2018

ok

@John905
Copy link
Contributor

John905 commented May 9, 2018

img class="leaflet-image-layer leaflet-zoom-animated" src="http://localhost/images/example.jpg" alt="" style="z-index: 1; transform: translate3d(901px, 394px, 0px) matrix3d(-0.466, 0, 0, 0, 0, 0.498667, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); transform-origin: 0px 0px 0px;"
This is the before - I'm not seeing positions in the after, just the image. I'm looking through the properties.

@jywarren
Copy link
Member Author

jywarren commented May 9, 2018

Maybe double check that these values change when you distort, and you could also log out the actual webgldistort() command parameters to confirm they're passed along.

Looking very close! Great work here! 👍 💪

@jywarren
Copy link
Member Author

Just noting relation to #97

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

2 participants