<commit_before>﻿using NoteEditor.Model;
using UniRx;
using UniRx.Triggers;
using UnityEngine;
using UnityEngine.UI;

namespace NoteEditor.Presenter
{
    public class ToggleDisplaySettingsPresenter : MonoBehaviour
    {
        [SerializeField]
        Button toggleDisplaySettingsButton;
        [SerializeField]
        Transform settingsWindowTransform;

        bool isMouseOverOnSettingsWindow = false;

        void Awake()
        {
            toggleDisplaySettingsButton.OnClickAsObservable()
                .Subscribe(_ => Settings.IsOpen.Value = !Settings.IsOpen.Value);

            Observable.Merge(
                    this.UpdateAsObservable()
                        .Where(_ => Settings.IsOpen.Value)
                        .Where(_ => Input.GetKey(KeyCode.Escape)),
                    this.UpdateAsObservable()
                        .Where(_ => Settings.IsOpen.Value)
                        .Where(_ => !isMouseOverOnSettingsWindow && Input.GetMouseButtonDown(0)))
                .Subscribe(_ => Settings.IsOpen.Value = false);

            Settings.IsOpen.Select(isViewing => isViewing ? Vector3.zero : Vector3.up * 100000)
                .Subscribe(pos => settingsWindowTransform.localPosition = pos);

            Settings.IsOpen.Subscribe(_ => Settings.SelectedBlock.Value = -1);<commit_msg>Rename<commit_after>﻿using NoteEditor.Model;
using UniRx;
using UniRx.Triggers;
using UnityEngine;
using UnityEngine.UI;

namespace NoteEditor.Presenter
{
    public class ToggleDisplaySettingsPresenter : MonoBehaviour
    {
        [SerializeField]
        Button toggleDisplaySettingsButton;
        [SerializeField]
        Transform settingsWindowTransform;

        bool isMouseOverOnSettingsWindow = false;

        void Awake()
        {
            toggleDisplaySettingsButton.OnClickAsObservable()
                .Subscribe(_ => Settings.IsOpen.Value = !Settings.IsOpen.Value);

            Observable.Merge(
                    this.UpdateAsObservable()
                        .Where(_ => Settings.IsOpen.Value)
                        .Where(_ => Input.GetKey(KeyCode.Escape)),
                    this.UpdateAsObservable()
                        .Where(_ => Settings.IsOpen.Value)
                        .Where(_ => !isMouseOverOnSettingsWindow && Input.GetMouseButtonDown(0)))
                .Subscribe(_ => Settings.IsOpen.Value = false);

            Settings.IsOpen.Select(isOpen => isOpen ? Vector3.zero : Vector3.up * 100000)
                .Subscribe(pos => settingsWindowTransform.localPosition = pos);

            Settings.IsOpen.Subscribe(_ => Settings.SelectedBlock.Value = -1);
{'fraction_non_alphanumeric': 0.09509319132750095, 'fraction_numerical': 0.007607455306200076, 'mean_word_length': 2.142174432497013, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 21, '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': '4555926', 'n_tokens_mistral': 690, 'n_tokens_neox': 645, 'n_words': 113}