<commit_before>import Ember from 'ember';
import d3 from 'npm:d3';
import d3lper from 'khartis/utils/d3lper';
import Struct from './struct';
import Projection from './projection';
import Basemap from './basemap';

const MARGIN_DEFAULTS = {t: 30, b: 30, l: 16, r: 16};

var Margin = Struct.extend({
  
  manual: false,
  l: MARGIN_DEFAULTS.l,
  r: MARGIN_DEFAULTS.r,
  t: MARGIN_DEFAULTS.t,
  b: MARGIN_DEFAULTS.b,
  
  h: function() {
    return this.get('l') + this.get('r');
  }.property('l', 'r'),
  
  v: function() {
    return this.get('t') + this.get('b');
  }.property('t', 'b'),

  getInitialValue(k) {
    return MARGIN_DEFAULTS[k];
  },

  resetValue(k) {
    this.set(k, MARGIN_DEFAULTS[k]);
  },

  deferredChange: Ember.debouncedObserver(
    'l', 'r', 't', 'b', 'h', 'v',
    function() {
      this.notifyDefferedChange();
    },
    50),
  
  export() {
    return this._super({
      manual: this.get('manual'),
      l: this.get('l'),
      r: this.get('r'),
      t: this.get('t'),
      b: this.get('b')
    });
  }
  
});

Margin.reopenClass({
  
  restore(json, refs = {}) {
      let o = this._super(json, refs);
      o.setProperties({
          manual: json.manual,
          l: json.l,
          r: json.r,
          t: json.t,
          b: json.b
      });
      return o;
  }
    
});

var GraphLayout = Struct.extend({
	
  basemap: null,
  
	stroke: "#ffffff",
	strokeWidth: 1,
	
	backgroundColor: "#f8f8f8",
  backmapColor: "#cfd1d1",

  backlandsColor: function() {
    /*let color = d3.rgb(this.get('backmapColor')),
        contrast = d3lper.yiqColor(color);
    return contrast === "lighten" ? color.brighter(0.222) : color.darker(0.222);*/
    return "#e0e1e1";
  }.property('backmapColor'),
  
  showBorders: true,

  showGrid: true,
  gridColor: "#e1e3ee",
  
  showLegend: null,
	
	autoCenter: false,

  canDisplayGrid: function() {
    return !this.get('projection.isComposite');
  }.property('projection', 'projection.isComposite'),

  canDisplaySphere: function() {
    return !this.get('projection.isComposite');
  }.property('projection', 'projection.isComposite'),
	
  tx: 0,
  ty: 0,
	width: 1024,
	height: 1024,
	margin: null,
  zoom: 1,
  precision: 2.5,<commit_msg>change default map layout dimensions<commit_after>import Ember from 'ember';
import d3 from 'npm:d3';
import d3lper from 'khartis/utils/d3lper';
import Struct from './struct';
import Projection from './projection';
import Basemap from './basemap';

const MARGIN_DEFAULTS = {t: 30, b: 30, l: 16, r: 16};

var Margin = Struct.extend({
  
  manual: false,
  l: MARGIN_DEFAULTS.l,
  r: MARGIN_DEFAULTS.r,
  t: MARGIN_DEFAULTS.t,
  b: MARGIN_DEFAULTS.b,
  
  h: function() {
    return this.get('l') + this.get('r');
  }.property('l', 'r'),
  
  v: function() {
    return this.get('t') + this.get('b');
  }.property('t', 'b'),

  getInitialValue(k) {
    return MARGIN_DEFAULTS[k];
  },

  resetValue(k) {
    this.set(k, MARGIN_DEFAULTS[k]);
  },

  deferredChange: Ember.debouncedObserver(
    'l', 'r', 't', 'b', 'h', 'v',
    function() {
      this.notifyDefferedChange();
    },
    50),
  
  export() {
    return this._super({
      manual: this.get('manual'),
      l: this.get('l'),
      r: this.get('r'),
      t: this.get('t'),
      b: this.get('b')
    });
  }
  
});

Margin.reopenClass({
  
  restore(json, refs = {}) {
      let o = this._super(json, refs);
      o.setProperties({
          manual: json.manual,
          l: json.l,
          r: json.r,
          t: json.t,
          b: json.b
      });
      return o;
  }
    
});

var GraphLayout = Struct.extend({
	
  basemap: null,
  
	stroke: "#ffffff",
	strokeWidth: 1,
	
	backgroundColor: "#f8f8f8",
  backmapColor: "#cfd1d1",

  backlandsColor: function() {
    /*let color = d3.rgb(this.get('backmapColor')),
        contrast = d3lper.yiqColor(color);
    return contrast === "lighten" ? color.brighter(0.222) : color.darker(0.222);*/
    return "#e0e1e1";
  }.property('backmapColor'),
  
  showBorders: true,

  showGrid: true,
  gridColor: "#e1e3ee",
  
  showLegend: null,
	
	autoCenter: false,

  canDisplayGrid: function() {
    return !this.get('projection.isComposite');
  }.property('projection', 'projection.isComposite'),

  canDisplaySphere: function() {
    return !this.get('projection.isComposite');
  }.property('projection', 'projection.isComposite'),
	
  tx: 0,
  ty: 0,
	width: 900,
	height: 700,
	margin: null,
  zoom: 1,
  precision: 2.5,
{'fraction_non_alphanumeric': 0.17891661047426388, 'fraction_numerical': 0.021128343447965835, 'mean_word_length': 2.9138082673702725, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '209627', 'n_tokens_mistral': 1787, 'n_tokens_neox': 1688, 'n_words': 353}