Skip to content

Commit 0e43714

Browse files
committed
Set style width only to allow responsive layouts.
1 parent 3bc182a commit 0e43714

File tree

2 files changed

+0
-9
lines changed

2 files changed

+0
-9
lines changed

js/load-image-scale.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,6 @@
304304
loadImage.transformCoordinates(canvas, options, data)
305305
if (pixelRatio > 1) {
306306
canvas.style.width = canvas.width / pixelRatio + 'px'
307-
canvas.style.height = canvas.height / pixelRatio + 'px'
308307
}
309308
loadImage
310309
.drawImage(

test/test.js

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -537,13 +537,11 @@
537537
expect(img.width).to.equal(240)
538538
expect(img.height).to.equal(160)
539539
expect(img.style.width).to.equal('120px')
540-
expect(img.style.height).to.equal('80px')
541540
// Check if pixelRatio scaling is idempotent:
542541
var img2 = loadImage.scale(img, { minWidth: 120, pixelRatio: 2 })
543542
expect(img2.width).to.equal(240)
544543
expect(img2.height).to.equal(160)
545544
expect(img2.style.width).to.equal('120px')
546-
expect(img2.style.height).to.equal('80px')
547545
done()
548546
},
549547
{ minWidth: 120, canvas: true, pixelRatio: 2 }
@@ -559,13 +557,11 @@
559557
expect(img.width).to.equal(60)
560558
expect(img.height).to.equal(40)
561559
expect(img.style.width).to.equal('30px')
562-
expect(img.style.height).to.equal('20px')
563560
// Check if pixelRatio scaling is idempotent:
564561
var img2 = loadImage.scale(img, { minWidth: 30, pixelRatio: 2 })
565562
expect(img2.width).to.equal(60)
566563
expect(img2.height).to.equal(40)
567564
expect(img2.style.width).to.equal('30px')
568-
expect(img2.style.height).to.equal('20px')
569565
done()
570566
},
571567
{ maxWidth: 30, canvas: true, pixelRatio: 2 }
@@ -913,7 +909,6 @@
913909
expect(img.width).to.equal(80)
914910
expect(img.height).to.equal(80)
915911
expect(img.style.width).to.equal('40px')
916-
expect(img.style.height).to.equal('40px')
917912
done()
918913
},
919914
{ maxWidth: 40, maxHeight: 40, crop: true, pixelRatio: 2 }
@@ -929,7 +924,6 @@
929924
expect(img.width).to.equal(80)
930925
expect(img.height).to.equal(80)
931926
expect(img.style.width).to.equal('40px')
932-
expect(img.style.height).to.equal('40px')
933927
done()
934928
},
935929
{ sourceWidth: 40, sourceHeight: 40, crop: true, pixelRatio: 2 }
@@ -1087,7 +1081,6 @@
10871081
expect(img.width).to.equal(80)
10881082
expect(img.height).to.equal(120)
10891083
expect(img.style.width).to.equal('40px')
1090-
expect(img.style.height).to.equal('60px')
10911084
done()
10921085
},
10931086
{ orientation: 8, pixelRatio: 2 }
@@ -1103,7 +1096,6 @@
11031096
expect(img.width).to.equal(80)
11041097
expect(img.height).to.equal(120)
11051098
expect(img.style.width).to.equal('40px')
1106-
expect(img.style.height).to.equal('60px')
11071099
done()
11081100
},
11091101
{ orientation: 6, pixelRatio: 2 }

0 commit comments

Comments
 (0)