From 520aa679f34bafbc00626151075b0b123eceb516 Mon Sep 17 00:00:00 2001 From: xuri Date: Sun, 18 Oct 2020 00:01:33 +0800 Subject: Fix #706, #713 improve AddPicture performance, fix missing worksheet when rename with same names --- col.go | 23 ++--------------------- 1 file changed, 2 insertions(+), 21 deletions(-) (limited to 'col.go') diff --git a/col.go b/col.go index 19ce99b..f7a77da 100644 --- a/col.go +++ b/col.go @@ -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 -- cgit v1.2.1