Browse Source

Merge pull request #621 from flowerField/master

解决合并单元格情况下高度计算问题和格式刷的bug
master
文顶顶 4 years ago
committed by GitHub
parent
commit
9a8cb551a7
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      src/controllers/handler.js
  2. 4
      src/controllers/menuButton.js
  3. 15
      src/controllers/selection.js
  4. 15
      src/global/getRowlen.js

3
src/controllers/handler.js

@ -5684,8 +5684,7 @@ export default function luckysheetHandler() {
});
$('#luckysheet-wa-editor,#luckysheet-icon-morebtn-div,.luckysheet-toolbar-button').click(function(e){
// 取消格式刷状态
if(menuButton.luckysheetPaintModelOn){
if(this.id != 'luckysheet-icon-paintformat' && menuButton.luckysheetPaintModelOn){
menuButton.cancelPaintModel();
}
})

4
src/controllers/menuButton.js

@ -118,8 +118,8 @@ const menuButton = {
let _this = this;
//格式刷
$("#luckysheet-icon-paintformat").click(function(){
$("#luckysheet-icon-paintformat").click(function(e){
e.stopPropagation();
let _locale = locale();
let locale_paint = _locale.paint;

15
src/controllers/selection.js

@ -1765,16 +1765,23 @@ const selection = {
}
if(getObjType(x[c]) == "object"){
let format = ['bg','fc','ct','ht','vt','bl','it','cl','un','fs','ff','tb']
format.forEach(item=>{
Reflect.deleteProperty(x[c],item);
})
if(x[c].ct && x[c].ct.t === "inlineStr"){
delete value["ct"];
}else{
let format = ['bg','fc','ct','ht','vt','bl','it','cl','un','fs','ff','tb']
format.forEach(item=>{
Reflect.deleteProperty(x[c],item);
})
}
}
else{
x[c] = {"v": x[c] };
}
x[c] = $.extend(true, x[c], value);
if(x[c].ct && x[c].ct.t === "inlineStr"){
x[c].ct.s.forEach(item=> item = $.extend(true, item, value))
}
if(copyHasMC && ("mc" in x[c])){
if(x[c]["mc"].rs != null){

15
src/global/getRowlen.js

@ -36,12 +36,23 @@ function rowlenByRange(d, r1, r2, cfg) {
for(let c = 0; c < d[r].length; c++){
let cell = d[r][c];
if(cell == null || cell.mc != null){
if(cell == null){
continue;
}
if(cell != null && (cell.v != null || isInlineStringCell(cell)) ){
let cellWidth = colLocationByIndex(c)[1] - colLocationByIndex(c)[0] - 2;
let cellWidth;
if(cell.mc){
if(c === cell.mc.c){
let st_cellWidth = colLocationByIndex(c)[0];
let ed_cellWidth = colLocationByIndex(cell.mc.c + cell.mc.cs - 1)[1];
cellWidth = ed_cellWidth - st_cellWidth - 2;
}else{
continue;
}
} else {
cellWidth = colLocationByIndex(c)[1] - colLocationByIndex(c)[0] - 2;
}
let textInfo = getCellTextInfo(cell, canvas,{
r:r,

Loading…
Cancel
Save