Skip to content

Commit

Permalink
[image-url] Fixe a mixup where a crop parameter relied on the horizon…
Browse files Browse the repository at this point in the history
…tal dimension where it should rely on the vertical
  • Loading branch information
simen committed Mar 1, 2019
1 parent 42f8f1f commit 393b1a2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
2 changes: 1 addition & 1 deletion packages/@sanity/image-url/src/urlForImage.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export default function urlForImage(options) {
left: hotSpotCenterX - hotSpotHorizontalRadius,
top: hotSpotCenterY - hotSpotVerticalRadius,
right: hotSpotCenterX + hotSpotHorizontalRadius,
bottom: hotSpotCenterY + hotSpotHorizontalRadius
bottom: hotSpotCenterY + hotSpotVerticalRadius
}

spec.asset = asset
Expand Down
9 changes: 2 additions & 7 deletions packages/@sanity/image-url/test/urlForHotspotImage.test.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
import urlForHotspotImage from '../src/urlForImage'
import {
uncroppedImage,
croppedImage,
noHotspotImage,
materializedAssetWithCrop
} from './fixtures'
import {uncroppedImage, croppedImage, noHotspotImage, materializedAssetWithCrop} from './fixtures'

describe('urlForHotspotImage', () => {
test('does not crop when no crop is required', () => {
Expand Down Expand Up @@ -65,7 +60,7 @@ describe('urlForHotspotImage', () => {
height: 30
})
).toBe(
'https://cdn.sanity.io/images/zp7mbokg/production/Tb9Ew8CXIwaY6R1kjMvI0uRR-2000x3000.jpg?rect=0,525,2000,600&w=100&h=30'
'https://cdn.sanity.io/images/zp7mbokg/production/Tb9Ew8CXIwaY6R1kjMvI0uRR-2000x3000.jpg?rect=0,600,2000,600&w=100&h=30'
)
})

Expand Down

0 comments on commit 393b1a2

Please sign in to comment.