Skip to content

Commit

Permalink
fix: resizing selection band (#126)
Browse files Browse the repository at this point in the history
Co-authored-by: Vittorio Cellucci <vel@qlik.com>
  • Loading branch information
vcellu and vcellu committed Nov 10, 2022
1 parent 91fdfce commit 614e284
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 4 deletions.
2 changes: 2 additions & 0 deletions ios/ColumnResizerView.swift
Expand Up @@ -20,6 +20,7 @@ class ColumnResizerView: UIView {
weak var button: ResizerButtonView?
weak var horizontalScrollView: UIScrollView?
weak var containerView: ContainerView?
weak var selectionsBand: SelectionBand?

init( _ columnWidths: ColumnWidths, index: Int, bindTo bindedTableView: TableView) {
self.columnWidths = columnWidths
Expand Down Expand Up @@ -130,6 +131,7 @@ class ColumnResizerView: UIView {
containerView?.updateVScrollPos()
updateHeader(translation)
updateTotals(translation)
selectionsBand?.updateSize(translation, withColumn: 0)
containerView?.testTruncation()
tableView.layoutIfNeeded()
}
Expand Down
1 change: 1 addition & 0 deletions ios/LastColumnResizer.swift
Expand Up @@ -28,6 +28,7 @@ class LastColumnResizer: MultiColumnResizer {
data.childCollectionView?.collectionViewLayout.invalidateLayout()
updateHeader(translation)
updateTotals(translation)
selectionsBand?.updateSize(translation, withColumn: index + 1)
containerView?.testTruncation()
}
}
Expand Down
2 changes: 1 addition & 1 deletion ios/MulitColumnResizer.swift
Expand Up @@ -34,7 +34,7 @@ class MultiColumnResizer: ColumnResizerView {
updateHeader(translation)
updateTotals(translation)
updateAdjacent(by: translation.x)

selectionsBand?.updateSize(translation, withColumn: index + 1)
containerView?.testTruncation()
}
}
Expand Down
2 changes: 0 additions & 2 deletions ios/PaddedLabel.swift
Expand Up @@ -275,8 +275,6 @@ class PaddedLabel: UILabel, SelectionsListener, ConstraintCellProtocol {
}
}



func setAttributedText(_ t: String, withIcon: UniChar, element: DataCell) {
var iconColor = UIColor.black// self.textColor;
var applyTextColor = false
Expand Down
2 changes: 1 addition & 1 deletion ios/SelectionBand.swift
Expand Up @@ -181,7 +181,7 @@ class SelectionBand: UIView {

func updateSize(_ translation: CGPoint, withColumn col: Int) {
guard let selectionBandResizer = self.selectionBandResizer else { return }
if Double(col) == activeColIdx && selectionBandResizer.frame.width > 0 {
if selectionBandResizer.frame.width > 0 {
let newFrame = CGRect(origin: selectionBandResizer.frame.origin,
size: CGSize(width: selectionBandResizer.frame.width + translation.x,
height: selectionBandResizer.frame.height))
Expand Down
4 changes: 4 additions & 0 deletions ios/TableViewFactory.swift
Expand Up @@ -156,6 +156,8 @@ class TableViewFactory {
resizer.horizontalScrollView = horizontalScrollView
resizer.headerView = firstColumnTableView.headerView
resizer.totalsView = firstColumnTableView.totalView
resizer.selectionsBand = firstColumnTableView.dataCollectionView?.selectionBand

resizer.translatesAutoresizingMaskIntoConstraints = false
resizer.borderColor = ColorParser.fromCSS(cssString: containerView.tableTheme?.borderBackgroundColor ?? "lightgray")
containerView.hScrollViewDelegate.grabber = resizer
Expand Down Expand Up @@ -247,6 +249,7 @@ class TableViewFactory {
resizer.horizontalScrollView = horizontalScrollView
resizer.containerView = containerView
resizer.borderColor = ColorParser.fromCSS(cssString: containerView.tableTheme?.borderBackgroundColor ?? "lightGray")
resizer.selectionsBand = multiColumnTableView.dataCollectionView?.selectionBand
resizer.layer.zPosition = 1
multiColumnTableView.addSubview(resizer)
let constraints = [
Expand Down Expand Up @@ -281,6 +284,7 @@ class TableViewFactory {
resizer.containerView = containerView
resizer.totalsView = multiColumnTableView.totalView
resizer.headerView = multiColumnTableView.headerView
resizer.selectionsBand = multiColumnTableView.dataCollectionView?.selectionBand
grabbers.append({[weak resizer] in return resizer})
let width = columnWidths.getTotalWidth(range: 1..<columnWidths.count())
multiColumnTableView.addSubview(resizer)
Expand Down

0 comments on commit 614e284

Please sign in to comment.