From 047dfeebd4d93a5aceb9a387fb1f62de20c5e389 Mon Sep 17 00:00:00 2001 From: mengshukeji Date: Wed, 21 Oct 2020 14:36:38 +0800 Subject: [PATCH 1/3] docs(api): api 1.add api docs:setRowHeight/setColumnWidth/setSheetZoom/setDataVerification/deleteDataVerification/setProtection --- docs/guide/api.md | 131 +++++++++++++++++++++++++++++++++++++++ docs/guide/config.md | 19 ++++++ docs/zh/guide/api.md | 132 ++++++++++++++++++++++++++++++++++++++++ docs/zh/guide/config.md | 19 ++++++ 4 files changed, 301 insertions(+) diff --git a/docs/guide/api.md b/docs/guide/api.md index 927b12bc0..f9a95c9dd 100644 --- a/docs/guide/api.md +++ b/docs/guide/api.md @@ -541,6 +541,54 @@ Use note: ------------ +### setRowHeight(rowInfo [,setting]) + +(TODO) + +- **Parameter**: + + - {Object} [rowInfo]: Correspondence between number of rows and height + + - {PlainObject} [setting]: optional parameters + + {Number} [order]: Worksheet subscript; the default value is the current worksheet subscript + + {Function} [success]: callback function for the end of the operation + +- **Explanation**: + + Set the height of the specified ~~row~~ + +- **Usage**: + + - Set the height of the first row to 50px and the height of the second row to 60px + + `luckysheet.setRowHeight({0:50,1:60})` + +------------ + +### setColumnWidth(columnInfo [,setting]) + +(TODO) + +- **Parameter**: + + - {Number} [columnInfo]: Correspondence between the number of columns and the width + + - {PlainObject} [setting]: optional parameters + + {Number} [order]: Worksheet subscript; the default value is the current worksheet subscript + + {Function} [success]: callback function for the end of the operation + +- **Explanation**: + + Set the width of the specified column + +- **Usage**: + + - Set the width of the first column to 50px and the width of the second column to 60px + + `luckysheet.setColumnWidth({0:50,1:60})` + +------------ + ## Selection operation ### getRange() @@ -2013,6 +2061,32 @@ Use note: ------------ +### setSheetZoom(zoom [,setting]) + +[todo] + + +- **Parameter**: + + - {Number} [zoom]: Worksheet zoom ratio + + - {PlainObject} [setting]: optional parameters + + {Function} [success]: callback function for the end of the operation + +- **Explanation**: + + Set worksheet zoom ratio + + +- **Usage**: + + - Set the current worksheet zoom ratio to 0.5 + ```js + luckysheet.setSheetZoom(0.5) + ``` + +------------ + ### showGridLines([setting]) - **Parameter**: @@ -2295,6 +2369,63 @@ Use note: ------------ +## Data Verification + +### setDataVerification(option, [setting]) + +[todo] + +- **Parameter**: + + - {Object} [option]: Configuration information for data verification + - {PlainObject} [setting]: optional parameters + + {Array | Object | String} [range]: The selection area for data verification, The format of the supported selection is `"A1:B2"`, `"sheetName!A1:B2"` or `{row:[0,1] ,column:[0,1]}`, can only be a single selection; the default is the current selection + + {Number} [order]: Worksheet subscript; the default value is the current worksheet subscript + + {Function} [success]: callback function for the end of the operation + +- **Explanation**: + + Specify the worksheet range to set the data verification function and set the parameters + +------------ + +### deleteDataVerification([setting]) + +[todo, to be confirmed whether it is reasonable] + +- **Parameter**: + + - {PlainObject} [setting]: optional parameters + + {Array | Object | String} [range]: The selection area for data verification, The format of the supported selection is `"A1:B2"`, `"sheetName!A1:B2"` or `{row:[0,1] ,column:[0,1]}`, can only be a single selection; the default is the current selection + + {Number} [order]: Worksheet subscript; the default value is the current worksheet subscript + + {Function} [success]: callback function for the end of the operation + +- **Explanation**: + + Specify the worksheet range to delete the data verification function + +------------ + +## Worksheet Protection + + +### setProtection(option, [setting]) + +[todo] + +- **Parameter**: + + - {Object} [option]: Configuration information for worksheet protection + - {PlainObject} [setting]: optional parameters + + {Number} [order]: Worksheet subscript; the default value is the current worksheet subscript + + {Function} [success]: callback function for the end of the operation + +- **Explanation**: + + Specify the worksheet to set the worksheet protection + +------------ + ## Public method ### transToCellData(data [,setting])
diff --git a/docs/guide/config.md b/docs/guide/config.md index a1c016c46..4d9e44ddc 100644 --- a/docs/guide/config.md +++ b/docs/guide/config.md @@ -743,6 +743,25 @@ The hook functions are uniformly configured under ʻoptions.hook`, and configura - {String} [oldColor]: Before modification, the current worksheet color - {String} [newColor]: After modification, the current worksheet color +------------ +### sheetZoomBefore +- Type: Function +- Default: null +- Usage: Before worksheet zoom +- Parameter: + - {Number} [i]: `index` of current worksheet + - {String} [zoom]: Current worksheet zoom ratio + +------------ +### sheetZoomAfter +- Type: Function +- Default: null +- Usage: After worksheet zoom +- Parameter: + - {Number} [i]: `index` of current worksheet + - {String} [oldZoom]: Before modification, the current worksheet zoom ratio + - {String} [newZoom]: After modification, the current worksheet zoom ratio + ------------ ## Workbook diff --git a/docs/zh/guide/api.md b/docs/zh/guide/api.md index 40ca681e9..3926831ab 100644 --- a/docs/zh/guide/api.md +++ b/docs/zh/guide/api.md @@ -543,6 +543,54 @@ Luckysheet针对常用的数据操作需求,开放了主要功能的API,开 ------------ +### setRowHeight(rowInfo [,setting]) + +(TODO) + +- **参数**: + + - {Object} [rowInfo]: 行数和高度对应关系 + + - {PlainObject} [setting]: 可选参数 + + {Number} [order]: 工作表下标;默认值为当前工作表下标 + + {Function} [success]: 操作结束的回调函数 + +- **说明**: + + 设置指定行的高度 + +- **示例**: + + - 设置第一行高度为50px,第二行高度为60px + + `luckysheet.setRowHeight({0:50,1:60})` + +------------ + +### setColumnWidth(columnInfo [,setting]) + +(TODO) + +- **参数**: + + - {Number} [columnInfo]: 列数和宽度对应关系 + + - {PlainObject} [setting]: 可选参数 + + {Number} [order]: 工作表下标;默认值为当前工作表下标 + + {Function} [success]: 操作结束的回调函数 + +- **说明**: + + 设置指定列的宽度 + +- **示例**: + + - 设置第一列宽度为50px,第二列宽度为60px + + `luckysheet.setColumnWidth({0:50,1:60})` + +------------ + ## 选区操作 ### getRange() @@ -1960,6 +2008,32 @@ Luckysheet针对常用的数据操作需求,开放了主要功能的API,开 ------------ +### setSheetZoom(zoom [,setting]) + +[todo] + + +- **参数**: + + - {Number} [zoom]: 工作表缩放比例 + + - {PlainObject} [setting]: 可选参数 + + {Function} [success]: 操作结束的回调函数 + +- **说明**: + + 设置工作表缩放比例 + + +- **示例**: + + - 设置当前工作表缩放比例为0.5 + ```js + luckysheet.setSheetZoom(0.5) + ``` + +------------ + ### showGridLines([setting]) - **参数**: @@ -2242,6 +2316,63 @@ Luckysheet针对常用的数据操作需求,开放了主要功能的API,开 ------------ +## 数据验证 + +### setDataVerification(option, [setting]) + +[todo] + +- **参数**: + + - {Object} [option]: 数据验证的配置信息 + - {PlainObject} [setting]: 可选参数 + + {Array | Object | String} [range]: 数据验证的选区范围,支持选区的格式为`"A1:B2"`、`"sheetName!A1:B2"`或者`{row:[0,1],column:[0,1]}`,只能为单个选区;默认为当前选区 + + {Number} [order]: 工作表下标;默认值为当前工作表下标 + + {Function} [success]: 操作结束的回调函数 + +- **说明**: + + 指定工作表范围设置数据验证功能,并设置参数 + +------------ + +### deleteDataVerification([setting]) + +[todo,待确认是否合理] + +- **参数**: + + - {PlainObject} [setting]: 可选参数 + + {Array | Object | String} [range]: 数据验证的选区范围,支持选区的格式为`"A1:B2"`、`"sheetName!A1:B2"`或者`{row:[0,1],column:[0,1]}`,只能为单个选区;默认为当前选区 + + {Number} [order]: 工作表下标;默认值为当前工作表下标 + + {Function} [success]: 操作结束的回调函数 + +- **说明**: + + 指定工作表范围删除数据验证功能 + +------------ + +## 工作表保护 + + +### setProtection(option, [setting]) + +[todo] + +- **参数**: + + - {Object} [option]: 工作表保护的配置信息 + - {PlainObject} [setting]: 可选参数 + + {Number} [order]: 工作表下标;默认值为当前工作表下标 + + {Function} [success]: 操作结束的回调函数 + +- **说明**: + + 指定工作表设置工作表保护功能 + +------------ + ## 公共方法 ### transToCellData(data [,setting])
@@ -2286,6 +2417,7 @@ Luckysheet针对常用的数据操作需求,开放了主要功能的API,开 ------------ + ## 旧版API ::: warning diff --git a/docs/zh/guide/config.md b/docs/zh/guide/config.md index 0d804e0c1..b3d54bdbc 100644 --- a/docs/zh/guide/config.md +++ b/docs/zh/guide/config.md @@ -744,6 +744,25 @@ Luckysheet开放了更细致的自定义配置选项,分别有 - {String} [oldColor]: 修改前当前sheet页颜色 - {String} [newColor]: 修改后当前sheet页颜色 +------------ +### sheetZoomBefore +- 类型:Function +- 默认值:null +- 作用:sheet缩放前 +- 参数: + - {Number} [i]: sheet页的`index` + - {String} [zoom]: 当前sheet页缩放比例 + +------------ +### sheetZoomAfter +- 类型:Function +- 默认值:null +- 作用:sheet缩放后 +- 参数: + - {Number} [i]: sheet页的`index` + - {String} [oldZoom]: 修改前当前sheet页缩放比例 + - {String} [newZoom]: 修改后当前sheet页缩放比例 + ------------ ## 工作簿 From 37c56ac416c79c7dddae01dfe8f8293e2dfec115 Mon Sep 17 00:00:00 2001 From: mengshukeji Date: Wed, 21 Oct 2020 14:52:16 +0800 Subject: [PATCH 2/3] docs(demo): demo demo add feature js --- docs/guide/README.md | 1 + docs/zh/guide/README.md | 1 + src/demoData/demoFeature.js | 0 src/index.html | 7 +++++-- 4 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 src/demoData/demoFeature.js diff --git a/docs/guide/README.md b/docs/guide/README.md index 272dcb490..9e8f407c4 100644 --- a/docs/guide/README.md +++ b/docs/guide/README.md @@ -136,6 +136,7 @@ After `npm run build`, all files in the `dist` folder are copied to the project + ``` diff --git a/docs/zh/guide/README.md b/docs/zh/guide/README.md index 950d61394..0659af5d3 100644 --- a/docs/zh/guide/README.md +++ b/docs/zh/guide/README.md @@ -137,6 +137,7 @@ npm run build + ``` diff --git a/src/demoData/demoFeature.js b/src/demoData/demoFeature.js new file mode 100644 index 000000000..e69de29bb diff --git a/src/index.html b/src/index.html index 4ea429daf..727a4b43b 100644 --- a/src/index.html +++ b/src/index.html @@ -16,6 +16,9 @@ + + + @@ -55,7 +58,7 @@ ], data: [sheetCell,sheetFormula,sheetConditionFormat,sheetSparkline,sheetTable,sheetComment,sheetPivotTableData,sheetPivotTable,sheetChart,sheetPicture,sheetDataVerification] - /*[{"name":"Sheet1","config":{"columnlen":{"0":241},"rowlen":{"0":81,"17":100}},"index":"1","status":"1","order":"0","luckysheet_select_save":[{"row":[0,0],"column":[4,4],"sheetIndex":1}],"zoomRatio":1,"showGridLines":"1","defaultColWidth":72,"defaultRowHeight":18,"celldata":[ + /*[{"name":"Sheet1","config":{"columnlen":{"0":241},"rowlen":{"0":81}},"index":"1","status":"1","order":"0","luckysheet_select_save":[{"row":[0,0],"column":[4,4],"sheetIndex":1}],"zoomRatio":1,"showGridLines":"1","defaultColWidth":72,"defaultRowHeight":18,"celldata":[ {"r":0,"c":0, "v":{ "ct":{ @@ -93,7 +96,7 @@ "qp":1, } }, - {"r":17,"c":2,"v":{"v":"Luckysheet is good project, this is true","ct":{"fa":"General","t":"g"},"bg":null,"bl":0,"it":0,"ff":0,"fs":"11","fc":"rgb(51, 51, 51)","ht":1,"vt":1,tb:2,"m":"Luckysheet"}} + {"r":17,"c":2,"v":{"v":"Luckysheet","ct":{"fa":"General","t":"g"},"bg":null,"bl":0,"it":0,"ff":0,"fs":"11","fc":"rgb(51, 51, 51)","ht":1,"vt":1,"m":"Luckysheet"}} ],"calcChain":[]}]*/ /* From 76dbb5cc613c8290696e917c554aff934050b6a2 Mon Sep 17 00:00:00 2001 From: wpxp123456 <2677556700@qq.com> Date: Wed, 21 Oct 2020 14:54:26 +0800 Subject: [PATCH 3/3] fix(bug): postil image zoom --- src/controllers/imageCtrl.js | 64 ++++++++++++++++++------------------ src/controllers/postil.js | 50 +++++++++++++++------------- src/controllers/zoom.js | 4 +++ src/global/draw.js | 8 ++--- 4 files changed, 68 insertions(+), 58 deletions(-) diff --git a/src/controllers/imageCtrl.js b/src/controllers/imageCtrl.js index 314404794..eb31e5867 100644 --- a/src/controllers/imageCtrl.js +++ b/src/controllers/imageCtrl.js @@ -97,19 +97,19 @@ const imageCtrl = { let src = imgItem.src; let imgItemParam = _this.getImgItemParam(imgItem); - let width = imgItemParam.width*Store.zoomRatio; - let height = imgItemParam.height*Store.zoomRatio; - let left = imgItemParam.left*Store.zoomRatio; - let top = imgItemParam.top*Store.zoomRatio; + let width = imgItemParam.width * Store.zoomRatio; + let height = imgItemParam.height * Store.zoomRatio; + let left = imgItemParam.left * Store.zoomRatio; + let top = imgItemParam.top * Store.zoomRatio; let position = imgItemParam.position; let borderWidth = imgItem.border.width; return `
- +
-
+
`; }, getSliderHtml: function() { @@ -354,10 +354,10 @@ const imageCtrl = { let item = _this.images[id]; let imgItemParam = _this.getImgItemParam(item); - let width = imgItemParam.width*Store.zoomRatio; - let height = imgItemParam.height*Store.zoomRatio; - let left = imgItemParam.left*Store.zoomRatio; - let top = imgItemParam.top*Store.zoomRatio; + let width = imgItemParam.width * Store.zoomRatio; + let height = imgItemParam.height * Store.zoomRatio; + let left = imgItemParam.left * Store.zoomRatio; + let top = imgItemParam.top * Store.zoomRatio; let position = imgItemParam.position; $("#luckysheet-modal-dialog-activeImage").show().css({ @@ -370,19 +370,19 @@ const imageCtrl = { $("#luckysheet-modal-dialog-activeImage .luckysheet-modal-dialog-content").css({ "background-image": "url(" + item.src + ")", - "background-size": item.default.width*Store.zoomRatio + "px " + item.default.height*Store.zoomRatio + "px", - "background-position": -item.crop.offsetLeft*Store.zoomRatio + "px " + -item.crop.offsetTop*Store.zoomRatio + "px" + "background-size": item.default.width * Store.zoomRatio + "px " + item.default.height * Store.zoomRatio + "px", + "background-position": -item.crop.offsetLeft * Store.zoomRatio + "px " + -item.crop.offsetTop * Store.zoomRatio + "px" }) $("#luckysheet-modal-dialog-activeImage .luckysheet-modal-dialog-border").css({ - "border-width": item.border.width*Store.zoomRatio, + "border-width": item.border.width * Store.zoomRatio, "border-style": item.border.style, "border-color": item.border.color, - "border-radius": item.border.radius*Store.zoomRatio, - "left": -item.border.width*Store.zoomRatio, - "right": -item.border.width*Store.zoomRatio, - "top": -item.border.width*Store.zoomRatio, - "bottom": -item.border.width*Store.zoomRatio, + "border-radius": item.border.radius * Store.zoomRatio, + "left": -item.border.width * Store.zoomRatio, + "right": -item.border.width * Store.zoomRatio, + "top": -item.border.width * Store.zoomRatio, + "bottom": -item.border.width * Store.zoomRatio, }) _this.sliderHtmlShow(); @@ -591,10 +591,10 @@ const imageCtrl = { let imgItem = _this.images[_this.currentImgId]; let imgItemParam = _this.getImgItemParam(imgItem); - let width = imgItemParam.width*Store.zoomRatio; - let height = imgItemParam.height*Store.zoomRatio; - let left = imgItemParam.left*Store.zoomRatio; - let top = imgItemParam.top*Store.zoomRatio; + let width = imgItemParam.width * Store.zoomRatio; + let height = imgItemParam.height * Store.zoomRatio; + let left = imgItemParam.left * Store.zoomRatio; + let top = imgItemParam.top * Store.zoomRatio; let position = imgItemParam.position; $("#" + _this.currentImgId).show().css({ @@ -605,20 +605,20 @@ const imageCtrl = { "position": position }); $("#" + _this.currentImgId + " img").css({ - "width": imgItem.default.width*Store.zoomRatio, - "height": imgItem.default.height*Store.zoomRatio, - "left": -imgItem.crop.offsetLeft*Store.zoomRatio, - "top": -imgItem.crop.offsetTop*Store.zoomRatio + "width": imgItem.default.width * Store.zoomRatio, + "height": imgItem.default.height * Store.zoomRatio, + "left": -imgItem.crop.offsetLeft * Store.zoomRatio, + "top": -imgItem.crop.offsetTop * Store.zoomRatio }); $("#" + _this.currentImgId + " .luckysheet-modal-dialog-border").css({ - "border-width": imgItem.border.width*Store.zoomRatio, + "border-width": imgItem.border.width * Store.zoomRatio, "border-style": imgItem.border.style, "border-color": imgItem.border.color, - "border-radius": imgItem.border.radius*Store.zoomRatio, - "left": -imgItem.border.width*Store.zoomRatio, - "right": -imgItem.border.width*Store.zoomRatio, - "top": -imgItem.border.width*Store.zoomRatio, - "bottom": -imgItem.border.width*Store.zoomRatio, + "border-radius": imgItem.border.radius * Store.zoomRatio, + "left": -imgItem.border.width * Store.zoomRatio, + "right": -imgItem.border.width * Store.zoomRatio, + "top": -imgItem.border.width * Store.zoomRatio, + "bottom": -imgItem.border.width * Store.zoomRatio, }) _this.currentImgId = null; diff --git a/src/controllers/postil.js b/src/controllers/postil.js index 4ae1daacc..40bd3cceb 100644 --- a/src/controllers/postil.js +++ b/src/controllers/postil.js @@ -208,18 +208,21 @@ const luckysheetPostil = { let toX = col; let toY = row_pre; - let fromX = toX + 18; - let fromY = toY - 18; + let fromX = toX + 18 * Store.zoomRatio; + let fromY = toY - 18 * Store.zoomRatio; if(fromY < 0){ fromY = 2; } + let width = _this.defaultWidth * Store.zoomRatio + let height = _this.defaultHeight * Store.zoomRatio + let size = _this.getArrowCanvasSize(fromX, fromY, toX, toY); let html = '
' + '' + - '
'+ value +'
' + + '
'+ value +'
' + '
'; $(html).appendTo($("#luckysheet-cell-main")); @@ -349,10 +352,10 @@ const luckysheetPostil = { let toX = col; let toY = row_pre; - let left = postil["left"] == null ? toX + 18 : postil["left"]; - let top = postil["top"] == null ? toY - 18 : postil["top"]; - let width = postil["width"] == null ? _this.defaultWidth : postil["width"]; - let height = postil["height"] == null ? _this.defaultHeight : postil["height"]; + let left = postil["left"] == null ? toX + 18 * Store.zoomRatio : postil["left"] * Store.zoomRatio; + let top = postil["top"] == null ? toY - 18 * Store.zoomRatio : postil["top"] * Store.zoomRatio; + let width = postil["width"] == null ? _this.defaultWidth * Store.zoomRatio : postil["width"] * Store.zoomRatio; + let height = postil["height"] == null ? _this.defaultHeight * Store.zoomRatio : postil["height"] * Store.zoomRatio; let value = postil["value"] == null ? "" : postil["value"]; if(top < 0){ @@ -418,18 +421,21 @@ const luckysheetPostil = { let toX = col; let toY = row_pre; - let fromX = toX + 18; - let fromY = toY - 18; + let fromX = toX + 18 * Store.zoomRatio; + let fromY = toY - 18 * Store.zoomRatio; if(fromY < 0){ fromY = 2; } + let width = _this.defaultWidth * Store.zoomRatio; + let height = _this.defaultHeight * Store.zoomRatio; + let size = _this.getArrowCanvasSize(fromX, fromY, toX, toY); let html = '
' + '' + - '
' + + '
' + '
' + '
' + '
' + @@ -507,10 +513,10 @@ const luckysheetPostil = { let toX = col; let toY = row_pre; - let left = postil["left"] == null ? toX + 18 : postil["left"]; - let top = postil["top"] == null ? toY - 18 : postil["top"]; - let width = postil["width"] == null ? _this.defaultWidth : postil["width"]; - let height = postil["height"] == null ? _this.defaultHeight : postil["height"]; + let left = postil["left"] == null ? toX + 18 * Store.zoomRatio : postil["left"] * Store.zoomRatio; + let top = postil["top"] == null ? toY - 18 * Store.zoomRatio : postil["top"] * Store.zoomRatio; + let width = postil["width"] == null ? _this.defaultWidth * Store.zoomRatio : postil["width"] * Store.zoomRatio; + let height = postil["height"] == null ? _this.defaultHeight * Store.zoomRatio : postil["height"] * Store.zoomRatio; let value = postil["value"] == null ? "" : postil["value"]; if(top < 0){ @@ -609,10 +615,10 @@ const luckysheetPostil = { let toX = col; let toY = row_pre; - let left = postil["left"] == null ? toX + 18 : postil["left"]; - let top = postil["top"] == null ? toY - 18 : postil["top"]; - let width = postil["width"] == null ? _this.defaultWidth : postil["width"]; - let height = postil["height"] == null ? _this.defaultHeight : postil["height"]; + let left = postil["left"] == null ? toX + 18 * Store.zoomRatio : postil["left"] * Store.zoomRatio; + let top = postil["top"] == null ? toY - 18 * Store.zoomRatio : postil["top"] * Store.zoomRatio; + let width = postil["width"] == null ? _this.defaultWidth * Store.zoomRatio : postil["width"] * Store.zoomRatio; + let height = postil["height"] == null ? _this.defaultHeight * Store.zoomRatio : postil["height"] * Store.zoomRatio; let value = postil["value"] == null ? "" : postil["value"]; if(top < 0){ @@ -723,10 +729,10 @@ const luckysheetPostil = { let toX = col; let toY = row_pre; - let left = postil["left"] == null ? toX + 18 : postil["left"]; - let top = postil["top"] == null ? toY - 18 : postil["top"]; - let width = postil["width"] == null ? _this.defaultWidth : postil["width"]; - let height = postil["height"] == null ? _this.defaultHeight : postil["height"]; + let left = postil["left"] == null ? toX + 18 * Store.zoomRatio : postil["left"] * Store.zoomRatio; + let top = postil["top"] == null ? toY - 18 * Store.zoomRatio : postil["top"] * Store.zoomRatio; + let width = postil["width"] == null ? _this.defaultWidth * Store.zoomRatio : postil["width"] * Store.zoomRatio; + let height = postil["height"] == null ? _this.defaultHeight * Store.zoomRatio : postil["height"] * Store.zoomRatio; let value = postil["value"] == null ? "" : postil["value"]; if(top < 0){ diff --git a/src/controllers/zoom.js b/src/controllers/zoom.js index 34d356954..711e3952a 100644 --- a/src/controllers/zoom.js +++ b/src/controllers/zoom.js @@ -5,6 +5,7 @@ import sheetmanage from './sheetmanage'; import {changeSheetContainerSize} from './resize'; import { jfrefreshgrid_rhcw } from '../global/refresh'; import server from './server'; +import luckysheetPostil from './postil'; import imageCtrl from './imageCtrl'; @@ -31,6 +32,9 @@ export function zoomChange(ratio){ let currentSheet = sheetmanage.getSheetByIndex(); + //批注 + luckysheetPostil.buildAllPs(currentSheet.data); + //图片 imageCtrl.images = currentSheet.images; imageCtrl.allImagesShow(); diff --git a/src/global/draw.js b/src/global/draw.js index 2ad7da42a..e62fb503e 100644 --- a/src/global/draw.js +++ b/src/global/draw.js @@ -1112,7 +1112,7 @@ let nullCellRender = function(r, c, start_r, start_c, end_r, end_c,luckysheetTab //若单元格有批注 if(Store.flowdata[r][c] != null && Store.flowdata[r][c].ps != null){ - let ps_w = 5*Store.zoomRatio, ps_h = 5*Store.zoomRatio; + let ps_w = 8*Store.zoomRatio, ps_h = 8*Store.zoomRatio; luckysheetTableContent.beginPath(); luckysheetTableContent.moveTo( (end_c + offsetLeft - 1- ps_w), (start_r + offsetTop)); luckysheetTableContent.lineTo( (end_c + offsetLeft - 1), (start_r + offsetTop)); @@ -1338,17 +1338,17 @@ let cellRender = function(r, c, start_r, start_c, end_r, end_c, value, luckyshee let verticalAlignPos_text = (pos_y + verticalCellHeight - space_height) ; //文本垂直方向基准线 luckysheetTableContent.textBaseline = "bottom"; - let verticalAlignPos_checkbox = verticalAlignPos_text - 13; + let verticalAlignPos_checkbox = verticalAlignPos_text - 13 * Store.zoomRatio; if(verticalAlign == "0"){ //居中对齐 verticalAlignPos_text = (pos_y + verticalCellHeight / 2); luckysheetTableContent.textBaseline = "middle"; - verticalAlignPos_checkbox = verticalAlignPos_text - 6; + verticalAlignPos_checkbox = verticalAlignPos_text - 6 * Store.zoomRatio; } else if(verticalAlign == "1"){ //上对齐 verticalAlignPos_text = (pos_y + space_height); luckysheetTableContent.textBaseline = "top"; - verticalAlignPos_checkbox = verticalAlignPos_text + 1; + verticalAlignPos_checkbox = verticalAlignPos_text + 1 * Store.zoomRatio; } horizonAlignPos = horizonAlignPos / Store.zoomRatio;