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

Added aspect ratio module #1454

Merged
merged 17 commits into from
Jan 16, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/modules/ConstrainedCrop/Module.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Crops an Image on the basic of the aspect ratio
* Crops an Image on the basic of the ratio provided
root00198 marked this conversation as resolved.
Show resolved Hide resolved
*/
module.exports = function ConstrainedCrop(options, UI) {

Expand All @@ -11,9 +11,9 @@ module.exports = function ConstrainedCrop(options, UI) {
var step = this,
startingX = Number(options.startingX || defaults.startingX),
startingY = Number(options.startingY || defaults.startingY),
aspectRatio = (options.aspectRatio || defaults.aspectRatio).split(':'),
widthRatio = Number(aspectRatio[0]),
heightRatio = Number(aspectRatio[1]);
constrainedRatio = (options.constrainedRatio || defaults.constrainedRatio).split(':'),
root00198 marked this conversation as resolved.
Show resolved Hide resolved
widthRatio = Number(constrainedRatio[0]),
heightRatio = Number(constrainedRatio[1]);

function extraManipulation(pixels) {
var width = pixels.shape[0],
Expand Down
2 changes: 1 addition & 1 deletion src/modules/ConstrainedCrop/info.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"desc": "Y-position (measured from top) from where cropping starts",
"default": 0
},
"aspectRatio":{
"constrainedRatio":{
"type": "string",
"desc": "Enter aspect ratio in following format width:height",
"default": "1:1"
Expand Down