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

Feature overlay top and left offset support #473

Merged
merged 8 commits into from
Jul 5, 2016
Merged

Feature overlay top and left offset support #473

merged 8 commits into from
Jul 5, 2016

Conversation

rn4391
Copy link

@rn4391 rn4391 commented Jun 23, 2016

No description provided.

@rn4391 rn4391 mentioned this pull request Jun 23, 2016
@lovell
Copy link
Owner

lovell commented Jun 24, 2016

Thank you very much for this, looks very useful. I'll make time over the weekend to review in more detail.

@@ -364,7 +365,10 @@ Sharp.prototype.overlayWith = function(overlay, options) {
throw new Error(' Invalid Value for tile ' + options.tile + 'Only Boolean Values allowed for overlay.tile.');
}

if (isInteger(options.gravity) && inRange(options.gravity, 0, 8)) {
if(isInteger(options.left) && options.left >= 0 && isInteger(options.top) && options.top >= 0) {
Copy link
Owner

Choose a reason for hiding this comment

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

Given the strictness in the rest of this function, I think if people try to define either left or top and either are invalid, it should also throw an Error.

@lovell
Copy link
Owner

lovell commented Jun 24, 2016

It's always a pleasure to see a PR with tests, thank you for adding these, it makes future maintenance of this feature so much easier.

I've added a couple of minor comments/nitpicks inline.

Are the overlay-offset-with-tile.jpg and overlay-very-large-offset.jpg test cases used?

@@ -8,7 +8,6 @@ var events = require('events');
var semver = require('semver');
var color = require('color');
var BluebirdPromise = require('bluebird');

Copy link
Owner

Choose a reason for hiding this comment

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

Nitpick: I like the separation between third and first-party dependencies.

@rn4391
Copy link
Author

rn4391 commented Jul 2, 2016

The Appveyor CI is failing and I am not sure why. Let me know if something has to be fixed.

@lovell
Copy link
Owner

lovell commented Jul 2, 2016

The latest version of npm should fix the AppVeyor problem - see npm/npm#13199

@lovell
Copy link
Owner

lovell commented Jul 3, 2016

This is looking great now, thank you.

Please can you remove the unused test expectations:

overlay-negative-offset.jpg
overlay-only-left-offset.jpg
overlay-only-top-offset.jpg

then rebase against upstream/master and squash to a single commit ready for merging.

@coveralls
Copy link

coveralls commented Jul 4, 2016

Coverage Status

Coverage increased (+0.05%) to 98.507% when pulling eeecb24 on rnanwani:feature_overlay_offset_support into 4b98dbb on lovell:master.

@rn4391
Copy link
Author

rn4391 commented Jul 5, 2016

I created a new branch with all the changes in a single commit. I still get a few merge commits from the master branch. Any ideas how do I squash them?

@lovell lovell merged commit 278273b into lovell:master Jul 5, 2016
@lovell lovell added this to the v0.15.1 milestone Jul 5, 2016
@lovell
Copy link
Owner

lovell commented Jul 5, 2016

Squashed as 278273b - thanks again Rahul for all you work on this handy addition.

lovell added a commit that referenced this pull request Jul 5, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants