mirror of
https://github.com/niklasvh/html2canvas.git
synced 2023-08-10 21:13:10 +03:00
Refactor border-radius update
This commit is contained in:
parent
b97972eeb6
commit
474b5e81a7
@ -216,17 +216,17 @@ export const parseBoundCurves = (
|
|||||||
factors.push((blh + brh) / bounds.width);
|
factors.push((blh + brh) / bounds.width);
|
||||||
factors.push((tlv + blv) / bounds.height);
|
factors.push((tlv + blv) / bounds.height);
|
||||||
factors.push((trv + brv) / bounds.height);
|
factors.push((trv + brv) / bounds.height);
|
||||||
let maxFactor = Math.max(...factors);
|
const maxFactor = Math.max(...factors);
|
||||||
|
|
||||||
if (maxFactor > 1) {
|
if (maxFactor > 1) {
|
||||||
tlh = tlh / maxFactor;
|
tlh /= maxFactor;
|
||||||
tlv = tlv / maxFactor;
|
tlv /= maxFactor;
|
||||||
trh = trh / maxFactor;
|
trh /= maxFactor;
|
||||||
trv = trv / maxFactor;
|
trv /= maxFactor;
|
||||||
brh = brh / maxFactor;
|
brh /= maxFactor;
|
||||||
brv = brv / maxFactor;
|
brv /= maxFactor;
|
||||||
blh = blh / maxFactor;
|
blh /= maxFactor;
|
||||||
blv = blv / maxFactor;
|
blv /= maxFactor;
|
||||||
}
|
}
|
||||||
|
|
||||||
const topWidth = bounds.width - trh;
|
const topWidth = bounds.width - trh;
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||||
<script type="text/javascript" src="../../test.js"></script>
|
<script type="text/javascript" src="../../test.js"></script>
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
div {
|
.box {
|
||||||
width: 200px;
|
width: 200px;
|
||||||
height: 200px;
|
height: 200px;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
@ -63,6 +63,21 @@
|
|||||||
border-radius: 200px;
|
border-radius: 200px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.gauge{
|
||||||
|
display: inline-block;
|
||||||
|
width: 100px;
|
||||||
|
height: 50px;
|
||||||
|
background: green;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.gauge1{ border-radius: 25px 25px 0 0 / 25px 25px 0 0; }
|
||||||
|
.gauge2{ border-radius: 100px 100px 0 0 / 50px 50px 0 0; }
|
||||||
|
.gauge3{ border-radius: 100px 100px 0 0 / 100px 100px 0 0; }
|
||||||
|
.gauge4{ border-radius: 300px 100px 0 0 / 100px 100px 0 0; }
|
||||||
|
.gauge5{ border-radius: 400px 400px 50px 50px / 50px 50px 50px 50px; }
|
||||||
|
|
||||||
|
|
||||||
html {
|
html {
|
||||||
background: #3a84c3;
|
background: #3a84c3;
|
||||||
}
|
}
|
||||||
@ -70,11 +85,16 @@
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<div class="box1"> </div>
|
<div class="box box1"> </div>
|
||||||
<div class="box2"> </div>
|
<div class="box box2"> </div>
|
||||||
<div class="box3"> </div>
|
<div class="box box3"> </div>
|
||||||
<div class="box4"> </div>
|
<div class="box box4"> </div>
|
||||||
<div class="box5"> </div>
|
<div class="box box5"> </div>
|
||||||
<div class="box6"> </div>
|
<div class="box box6"> </div>
|
||||||
|
<div class="gauge gauge1"></div>
|
||||||
|
<div class="gauge gauge2"></div>
|
||||||
|
<div class="gauge gauge3"></div>
|
||||||
|
<div class="gauge gauge4"></div>
|
||||||
|
<div class="gauge gauge5"></div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
Loading…
Reference in New Issue
Block a user