<commit_before>module.exports = function (container, layout) {
  container = container || document.body;
  var svgns = "http://www.w3.org/2000/svg";
  var svgRoot = document.createElementNS(svgns, "svg");
  container.appendChild(svgRoot);
  var elements = [];
  var layers = {};

  return {
    dispose: function () {
    },

    addElement: function (el) {
      var pos = layout.getNodePosition(el.model.id);
      Object.keys(el.layers).forEach(function (key) {
        var transform = svgRoot.createSVGTransform();
        var element = el.layers[key];
        elements.push({
          element: element,
          pos: pos,
          transform: transform
        });

        element.transform.baseVal.appendItem(transform);
        appendToLayer(key, element);
      });
    },

    setLayersOrder: function (layerNames) {
    },

    render: render
  };

  function appendToLayer(layerName, element) {
    var layer = layers[layerName];
    if (!layer) {
      layer = layers[layerName] = document.createElementNS(svgns, 'g');
      svgRoot.appendChild(layer);
    }

    layer.appendChild(element);
  }


  function render() {
    elements.forEach(renderElement);
  }<commit_msg>Using global transform on scene<commit_after>module.exports = function (container, layout) {
  container = container || document.body;
  var svgns = "http://www.w3.org/2000/svg";
  var svgRoot = document.createElementNS(svgns, "svg");
  var sceneRoot;
  initSceneRoot();

  container.appendChild(svgRoot);
  var elements = [];
  var layers = {};

  return {
    dispose: function () {
    },

    addElement: function (el) {
      var pos = layout.getNodePosition(el.model.id);
      Object.keys(el.layers).forEach(function (key) {
        var transform = svgRoot.createSVGTransform();
        var element = el.layers[key];
        elements.push({
          element: element,
          pos: pos,
          transform: transform
        });

        element.transform.baseVal.appendItem(transform);
        appendToLayer(key, element);
      });
    },

    setLayersOrder: function (layerNames) {
    },

    render: render
  };

  function appendToLayer(layerName, element) {
    var layer = layers[layerName];
    if (!layer) {
      layer = layers[layerName] = document.createElementNS(svgns, 'g');
      sceneRoot.appendChild(layer);
    }

    layer.appendChild(element);
  }

  function initSceneRoot() {
    sceneRoot = document.createElementNS(svgns, 'g');

    var transform = svgRoot.createSVGTransform();
    transform.setTranslate(container.clientWidth/2, container.clientHeight/2);
    sceneRoot.transform.baseVal.appendItem(transform);
    svgRoot.appendChild(sceneRoot);
  }

  function render() {
    elements.forEach(renderElement);
  }
{'fraction_non_alphanumeric': 0.12997444322745527, 'fraction_numerical': 0.004381161007667032, 'mean_word_length': 2.9311334289813487, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '4462821', 'n_tokens_mistral': 823, 'n_tokens_neox': 793, 'n_words': 155}