Skip to content

Commit

Permalink
feat: freeze first column ios
Browse files Browse the repository at this point in the history
  • Loading branch information
vcellu committed Sep 29, 2022
1 parent 021a86e commit 6ad6063
Show file tree
Hide file tree
Showing 12 changed files with 775 additions and 244 deletions.
9 changes: 9 additions & 0 deletions ios/ColumnWidths.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,15 @@ class ColumnWidths {
var columnWidths = [Double]();
var key: String?


func resetColumnWidths(widths: [Double]) {
columnWidths = widths
}

func count() -> Int {
return columnWidths.count
}

func loadDefaultWidths(_ frame: CGRect, columnCount: Int, dataRows: [DataRow]) {
if(!loadFromStorage(columnCount)) {
let defaultWidth = frame.width / Double(columnCount)
Expand Down Expand Up @@ -81,6 +86,10 @@ class ColumnWidths {
return columnWidths.reduce(0, { $0 + $1 })
}

func getTotalWidth(range: CountableRange<Int>) -> Double {
return columnWidths[range].reduce(0, { $0 + $1 })
}

func resize(index: Int, by: CGPoint) {
columnWidths[index] += by.x
if index + 1 < columnWidths.count {
Expand Down
Loading

0 comments on commit 6ad6063

Please sign in to comment.