diff options
author | xuri <xuri.me@gmail.com> | 2020-10-18 00:01:33 +0800 |
---|---|---|
committer | xuri <xuri.me@gmail.com> | 2020-10-18 00:01:33 +0800 |
commit | 520aa679f34bafbc00626151075b0b123eceb516 (patch) | |
tree | 532b53262f78f27351ea9647d9ec09c820b38b6f /col.go | |
parent | 02530e8c8ad94308458a33ac694e6ac9d3af4c87 (diff) |
Fix #706, #713 improve AddPicture performance, fix missing worksheet when rename with same names
Diffstat (limited to 'col.go')
-rw-r--r-- | col.go | 23 |
1 files changed, 2 insertions, 21 deletions
@@ -559,26 +559,7 @@ func flatCols(col xlsxCol, cols []xlsxCol, replacer func(fc, c xlsxCol) xlsxCol) // width # Width of object frame. // height # Height of object frame. // -// xAbs # Absolute distance to left side of object. -// yAbs # Absolute distance to top side of object. -// -func (f *File) positionObjectPixels(sheet string, col, row, x1, y1, width, height int) (int, int, int, int, int, int, int, int) { - xAbs := 0 - yAbs := 0 - - // Calculate the absolute x offset of the top-left vertex. - for colID := 1; colID <= col; colID++ { - xAbs += f.getColWidth(sheet, colID) - } - xAbs += x1 - - // Calculate the absolute y offset of the top-left vertex. - // Store the column change to allow optimisations. - for rowID := 1; rowID <= row; rowID++ { - yAbs += f.getRowHeight(sheet, rowID) - } - yAbs += y1 - +func (f *File) positionObjectPixels(sheet string, col, row, x1, y1, width, height int) (int, int, int, int, int, int) { // Adjust start column for offsets that are greater than the col width. for x1 >= f.getColWidth(sheet, col) { x1 -= f.getColWidth(sheet, col) @@ -613,7 +594,7 @@ func (f *File) positionObjectPixels(sheet string, col, row, x1, y1, width, heigh // The end vertices are whatever is left from the width and height. x2 := width y2 := height - return col, row, xAbs, yAbs, colEnd, rowEnd, x2, y2 + return col, row, colEnd, rowEnd, x2, y2 } // getColWidth provides a function to get column width in pixels by given |