mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-04-14 16:40:58 -04:00
fix for safari
This commit is contained in:
parent
3a68f0ae7b
commit
a0b968c8e0
1 changed files with 9 additions and 3 deletions
|
@ -329,13 +329,19 @@ export const measureBaseline = (
|
|||
let baseline = span.offsetTop + span.offsetHeight;
|
||||
const domHeight = container.offsetHeight;
|
||||
|
||||
// In Safari sometimes DOM height could be less than canvas height due to
|
||||
// which text could go out of the bounding box hence shifting the baseline
|
||||
// to make sure text is rendered correctly
|
||||
if (isSafari) {
|
||||
// In Safari sometimes DOM height could be less than canvas height due to
|
||||
// which text could go out of the bounding box hence shifting the baseline
|
||||
// to make sure text is rendered correctly
|
||||
if (canvasHeight > domHeight) {
|
||||
baseline += canvasHeight - domHeight;
|
||||
}
|
||||
// In Safari sometimes DOM height could be more than canvas height due to
|
||||
// which text could go out of the bounding box hence shifting the baseline
|
||||
// to make sure text is rendered correctly
|
||||
if (domHeight > canvasHeight) {
|
||||
baseline -= domHeight - canvasHeight;
|
||||
}
|
||||
}
|
||||
document.body.removeChild(container);
|
||||
return baseline;
|
||||
|
|
Loading…
Add table
Reference in a new issue