mirror of
https://github.com/niklasvh/html2canvas.git
synced 2023-08-10 21:13:10 +03:00
Support Firefox translation of background positions
This commit is contained in:
parent
fbe5e56cb9
commit
8003a47925
@ -130,6 +130,17 @@ export const getAbsoluteValue = (token: LengthPercentage, parent: number): numbe
|
||||
}
|
||||
}
|
||||
|
||||
// Firefox translates positions like "right 20px" as calc(100% + 20px)
|
||||
if (token.type === TokenType.FUNCTION) {
|
||||
if (token.name === 'calc' && token.values.length == 5) {
|
||||
let firstValue = getAbsoluteValue(token.values[0], parent);
|
||||
let secondValue = getAbsoluteValue(token.values[4], parent);
|
||||
|
||||
if (token.values[2].value == '-') return firstValue - secondValue;
|
||||
if (token.values[2].value == '+') return firstValue + secondValue;
|
||||
}
|
||||
}
|
||||
|
||||
if (isDimensionToken(token)) {
|
||||
switch (token.unit) {
|
||||
case 'rem':
|
||||
|
Loading…
Reference in New Issue
Block a user