<commit_before>//
//  SpreadsheetView+CirclularScrolling.swift
//  SpreadsheetView
//
//  Created by <NAME> on 5/1/17.
//  Copyright © 2017 <NAME>. All rights reserved.
//

import UIKit

extension SpreadsheetView {
    func scrollToHorizontalCenter() {
        rowHeaderView.state.contentOffset.x = centerOffset.x
        tableView.state.contentOffset.x = centerOffset.x
    }

    func scrollToVerticalCenter() {
        columnHeaderView.state.contentOffset.y = centerOffset.y
        tableView.state.contentOffset.y = centerOffset.y
    }

    func recenterHorizontallyIfNecessary() {
        let currentOffset = tableView.state.contentOffset
        let distance = currentOffset.x - centerOffset.x
        let threshold = tableView.state.contentSize.width / 4
        if fabs(distance) > threshold {
            if distance > 0 {
                columnHeaderView.state.contentOffset.x = distance
                tableView.state.contentOffset.x = distance
            } else {
                let offset = centerOffset.x + (centerOffset.x - threshold)
                columnHeaderView.state.contentOffset.x = offset
                tableView.state.contentOffset.x = offset
            }
        }
    }

    func recenterVerticallyIfNecessary() {
        let currentOffset = tableView.state.contentOffset
        let distance = currentOffset.y - centerOffset.y
        let threshold = tableView.state.contentSize.height / 4
        if fabs(distance) > threshold {
            if distance > 0 {
                columnHeaderView.state.contentOffset.y = distance
                tableView.state.contentOffset.y = distance
            } else {
                let offset = centerOffset.y + (centerOffset.y - threshold)
                columnHeaderView.state.contentOffset.y = offset
                tableView.state.contentOffset.y = offset<commit_msg>Fix blink column header when circular scrolling is enabled<commit_after>//
//  SpreadsheetView+CirclularScrolling.swift
//  SpreadsheetView
//
//  Created by <NAME> on 5/1/17.
//  Copyright © 2017 <NAME>. All rights reserved.
//

import UIKit

extension SpreadsheetView {
    func scrollToHorizontalCenter() {
        rowHeaderView.state.contentOffset.x = centerOffset.x
        tableView.state.contentOffset.x = centerOffset.x
    }

    func scrollToVerticalCenter() {
        columnHeaderView.state.contentOffset.y = centerOffset.y
        tableView.state.contentOffset.y = centerOffset.y
    }

    func recenterHorizontallyIfNecessary() {
        let currentOffset = tableView.state.contentOffset
        let distance = currentOffset.x - centerOffset.x
        let threshold = tableView.state.contentSize.width / 4
        if fabs(distance) > threshold {
            if distance > 0 {
                rowHeaderView.state.contentOffset.x = distance
                tableView.state.contentOffset.x = distance
            } else {
                let offset = centerOffset.x + (centerOffset.x - threshold)
                rowHeaderView.state.contentOffset.x = offset
                tableView.state.contentOffset.x = offset
            }
        }
    }

    func recenterVerticallyIfNecessary() {
        let currentOffset = tableView.state.contentOffset
        let distance = currentOffset.y - centerOffset.y
        let threshold = tableView.state.contentSize.height / 4
        if fabs(distance) > threshold {
            if distance > 0 {
                columnHeaderView.state.contentOffset.y = distance
                tableView.state.contentOffset.y = distance
            } else {
                let offset = centerOffset.y + (centerOffset.y - threshold)
                columnHeaderView.state.contentOffset.y = offset
                tableView.state.contentOffset.y = offset
{'fraction_non_alphanumeric': 0.08188386406208188, 'fraction_numerical': 0.006422263848006422, 'mean_word_length': 2.107231920199501, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7056809', 'n_tokens_mistral': 1018, 'n_tokens_neox': 962, 'n_words': 201}