<commit_before>import {Component, Input, OnInit} from '@angular/core';

import {Rule} from 'geostyler-style';

import {HsStylerPartBaseComponent} from '../style-part-base.component';

@Component({
  selector: 'hs-scale-denominator',
  templateUrl: './scale-denominator.html',
})
export class HsScaleDenominatorComponent
  extends HsStylerPartBaseComponent
  implements OnInit
{
  @Input() rule: Rule;

  scaleDenominator: {min: number; max: number} = {min: null, max: null};

  ngOnInit(): void {
    Object.assign(this.scaleDenominator, this.rule.scaleDenominator);
  }

  emitChange(): void {
    if (
      this.scaleDenominator.min === null &&
      this.scaleDenominator.max === null
    ) {
      delete this.rule.scaleDenominator;
      return;
    }
    if (this.rule.scaleDenominator == undefined) {
      this.rule.scaleDenominator = {};
    }
    Object.assign(this.rule.scaleDenominator, this.scaleDenominator);
    super.emitChange();
  }
}<commit_msg>fix(styler):Scale denominators cannot be reseted<commit_after>import {Component, Input, OnInit} from '@angular/core';

import {Rule} from 'geostyler-style';

import {HsStylerPartBaseComponent} from '../style-part-base.component';

@Component({
  selector: 'hs-scale-denominator',
  templateUrl: './scale-denominator.html',
})
export class HsScaleDenominatorComponent
  extends HsStylerPartBaseComponent
  implements OnInit
{
  @Input() rule: Rule;

  scaleDenominator: {min: number; max: number} = {min: null, max: null};

  ngOnInit(): void {
    Object.assign(this.scaleDenominator, this.rule.scaleDenominator);
  }

  emitChange(): void {
    if (
      this.scaleDenominator.min === null &&
      this.scaleDenominator.max === null
    ) {
      delete this.rule.scaleDenominator;
      super.emitChange();
      return;
    }

    if (this.rule.scaleDenominator == undefined) {
      this.rule.scaleDenominator = {};
    }
    Object.assign(this.rule.scaleDenominator, this.scaleDenominator);
 
    //After assign to keep max inut empty -> prevent 'out of range' warning
    if (
      this.rule.scaleDenominator.max === null &&
      this.rule.scaleDenominator.min !== null
    ) {
      this.rule.scaleDenominator.max = Infinity;
    }
    super.emitChange();
  }
}
{'fraction_non_alphanumeric': 0.13410818059901655, 'fraction_numerical': 0.0, 'mean_word_length': 3.5860655737704916, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, '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': '6819268', 'n_tokens_mistral': 733, 'n_tokens_neox': 718, 'n_words': 143}