Skip to content
This repository has been archived by the owner on Mar 28, 2024. It is now read-only.

Commit

Permalink
fix(text get wrong height when zoom): fix height
Browse files Browse the repository at this point in the history
  • Loading branch information
DR-Univer committed Aug 17, 2020
1 parent 9830714 commit 106f1fd
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
21 changes: 18 additions & 3 deletions src/controllers/zoom.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,23 @@ import {changeSheetContainerSize} from './resize';
import { jfrefreshgrid_rhcw } from '../global/refresh';



let luckysheetZoomTimeout = null;

export function zoomChange(ratio){
if(Store.flowdata==null || Store.flowdata.length==0){
return;
}

Store.zoomRatio = ratio;

jfrefreshgrid_rhcw(Store.flowdata.length, Store.flowdata[0].length);

changeSheetContainerSize();
clearTimeout(luckysheetZoomTimeout);
luckysheetZoomTimeout = setTimeout(() => {
jfrefreshgrid_rhcw(Store.flowdata.length, Store.flowdata[0].length);
changeSheetContainerSize();
}, 100);


}


Expand All @@ -31,6 +38,10 @@ export function zoomInitial(){

currentRatio = currentRatio-0.1;

if(currentRatio==Store.zoomRatio){
currentRatio = currentRatio-0.1;
}

if(currentRatio<=0.1){
currentRatio = 0.1;
}
Expand All @@ -51,6 +62,10 @@ export function zoomInitial(){

currentRatio = currentRatio+0.1;

if(currentRatio==Store.zoomRatio){
currentRatio = currentRatio+0.1;
}

if(currentRatio>=4){
currentRatio = 4;
}
Expand Down
2 changes: 1 addition & 1 deletion src/global/getRowlen.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ function getMeasureText(value, ctx){
cache.width *= Store.zoomRatio;
cache.actualBoundingBoxDescent *= Store.zoomRatio;
cache.actualBoundingBoxAscent *= Store.zoomRatio;
Store.measureTextCache[value + "_" + ctx.font] = cache;
Store.measureTextCache[value + "_" + Store.zoomRatio + "_" + ctx.font] = cache;

return cache;
}
Expand Down

0 comments on commit 106f1fd

Please sign in to comment.