<commit_before>//
//  PanelManager+Pinning.swift
//  PanelKit
//
//  Created by <NAME> on 07/03/2017.
//  Copyright © 2017 Silver Fox. All rights reserved.
//

import UIKit

extension PanelManager {

	var panelPinnedLeft: PanelViewController? {
		return panels.filter { $0.pinnedSide == .left }.first
	}

	var panelPinnedRight: PanelViewController? {
		return panels.filter { $0.pinnedSide == .right }.first
	}

	func pinnedPanelFrame(for panel: PanelViewController, at side: PanelPinSide) -> CGRect? {

		guard let panelView = panel.view else {
			return nil
		}

		var previewTargetFrame = panelView.bounds

		previewTargetFrame.origin.y = 0.0

		switch side {
		case .left:
			previewTargetFrame.origin.x = 0.0
		case .right:
			previewTargetFrame.origin.x = panelContentWrapperView.bounds.width - panelView.bounds.width
		}

		previewTargetFrame.size.height = panelContentWrapperView.bounds.height - previewTargetFrame.origin.y

		return previewTargetFrame
	}

	func updatedContentViewFrame() -> CGRect {

		var updatedContentViewFrame = panelContentView.frame

		updatedContentViewFrame.size.width = panelContentWrapperView.bounds.width

		updatedContentViewFrame.origin.x = 0.0

		if let leftPanelSize = panelPinnedLeft?.contentViewController?.preferredPanelContentSize {
<commit_msg>Improved pinned panel preview view frame<commit_after>//
//  PanelManager+Pinning.swift
//  PanelKit
//
//  Created by <NAME> on 07/03/2017.
//  Copyright © 2017 Silver Fox. All rights reserved.
//

import UIKit

extension PanelManager {

	var panelPinnedLeft: PanelViewController? {
		return panels.filter { $0.pinnedSide == .left }.first
	}

	var panelPinnedRight: PanelViewController? {
		return panels.filter { $0.pinnedSide == .right }.first
	}

	func pinnedPanelFrame(for panel: PanelViewController, at side: PanelPinSide) -> CGRect? {

		guard let panelView = panel.view else {
			return nil
		}

		var previewTargetFrame = panelView.bounds

		previewTargetFrame.origin.y = panelContentView.frame.origin.y

		switch side {
		case .left:
			previewTargetFrame.origin.x = 0.0
		case .right:
			previewTargetFrame.origin.x = panelContentWrapperView.bounds.width - panelView.bounds.width
		}

		previewTargetFrame.size.height = panelContentWrapperView.bounds.height - previewTargetFrame.origin.y

		return previewTargetFrame
	}

	func updatedContentViewFrame() -> CGRect {

		var updatedContentViewFrame = panelContentView.frame

		updatedContentViewFrame.size.width = panelContentWrapperView.bounds.width

		updatedContentViewFrame.origin.x = 0.0

		if let leftPanelSize = panelPinnedLeft?.contentViewController?.preferredPanelContentSize {

{'fraction_non_alphanumeric': 0.09335863377609108, 'fraction_numerical': 0.014421252371916509, 'mean_word_length': 4.088803088803089, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, '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': '2643824', 'n_tokens_mistral': 882, 'n_tokens_neox': 766, 'n_words': 177}