<commit_before>
if (typeof define !== 'function') { var define = require(VVVVContext.Root+'/node_modules/amdefine')(module, VVVVContext.getRelativeRequire(require)) }

define(function(require,exports) {


var $ = require('jquery');
require('d3');
var VVVV = require('core/vvvv.core.defines');
var Makros = require('vvvv.makros');

var UIState = {
  'Idle': 0,
  'Connecting': 1,
  'Moving': 2,
  'Creating': 3,
  'Changing': 4,
  'AreaSelecting': 5,
  'PinDragging': 6,
  'Resizing': 7
}

function getAllUpstreamNodes(origin_node, node) {
  if (node==undefined)
    node = origin_node;
  var upnodes = [];
  var u = node.getUpstreamNodes();
  for (var j=0; j<u.length; j++) {
    if (u[j]!=origin_node && !u[j].delays_output) {
      upnodes.push(u[j]);
      upnodes = upnodes.concat(getAllUpstreamNodes(origin_node, u[j]));
    }
  }
  return upnodes;
}

function getAllDownstreamNodes(origin_node, node) {
  if (node==undefined)
    node = origin_node;
  var upnodes = [];
  var u = node.getDownstreamNodes();
  for (var j=0; j<u.length; j++) {
    if (u[j]!=origin_node && !u[j].delays_output) {
      upnodes.push(u[j]);
      upnodes = upnodes.concat(getAllDownstreamNodes(origin_node, u[j]));
    }
  }
  return upnodes;
}

var defaultOpacity = 0.85;
var blurredOpacity = 0.35;

VVVV.PinTypes.Value.makeLabel = VVVV.PinTypes.String.makeLabel = function(element, node) {
  var rowCount = node.IOBoxRows();
  var sliceCount = node.IOBoxInputPin().getSliceCount();
  /*d3.select(element)
  .append('svg:clipPath')
    .attr('id', 'clip-path-'+node.id)
    .append("svg:rect")
      .attr('width', node.getWidth())
      .attr('height', node.getHeight())*/

  d3.select(element).selectAll('.vvvv-node-label').remove();
  for (var i=0; i<rowCount; i++) {
    d3.select(element)
    .append('svg:text')
      .text(node.IOBoxInputPin().getValue(i))
      .attr('class', 'vvvv-node-label')
      .attr('shape-rendering', 'crispEdges')
      .attr('dy', function(d) {
        return i*12+12;
      })
      .attr('dx', 4)
      .attr('font-size', 10)
      .attr('font-family', "'Lucida Sans Unicode', sans-serif")
      //.attr('clip-path', 'url(#clip-path-'+node.id+')')
  }
}

VVVV.PinTypes.Value.openInputBox = VVVV.PinTypes.String.openInputBox = function(win, $element, pin, sliceIdx) {
  $inputbox = $("<input type='text' value='"+pin.getValue(sliceIdx).toString().replace(/\|/g, "||").replace(/'/g, '&apos;').replace(/</g, '&lt;').replace(/>/g, '&gt;')+"' class='pininputbox value resettable'/>");
  $inputbox.css('position', $element.css('position'));
  $inputbox.css('width', $element.css('width'));
  $inputbox.css('height', $element.css('height'));
  $inputbox.css('left', $element.css('left'));
  $inputbox.css('top', $element.css('top'));
  $element.replaceWith($inputbox);
  $inputbox.get(0).select();

  win.window.document.exitPointerLock = win.window.document.exitPointerLock    ||
                                        win.window.document.mozExitPointerLock ||
                                        win.window.document.webkitExitPointerLock;

  $inputbox.change(function() {
    if (pin.typeName=="Value")
      pin.setValue(sliceIdx, parseFloat($(this).val()));
    else
      pin.setValue(sliceIdx, $(this).val());
    var cmd = {syncmode: 'diff', nodes: {}, links: []};
    cmd.nodes[pin.node.id] = {pins: {}};
    cmd.nodes[pin.node.id].pins[pin.pinname] = {values: pin.values};
    pin.node.parentPatch.editor.update(pin.node.parentPatch, cmd);
    //pin.node.parentPatch.afterUpdate();
  });
  $inputbox.keydown(function(e) {
    if (e.which==13) {
      $(this).change();
      $(this).remove();
    }
  });

  if (pin.typeName=='Value') {
    function scroll(el, delta, e) {
      var mod = $(el).val()%1;
      if (!isNaN(mod)) {
        var offset;
        offset = 1;
        if (e.altKey || mod!==0)
          offset = 1.0/100.0;
        delta *= offset;
        $(el).val(parseFloat($(el).val())+delta);
        $(el).change();
      }
    }<commit_msg>fix bug where nodes where deleted when hitting backspace while changing a pin value<commit_after>
if (typeof define !== 'function') { var define = require(VVVVContext.Root+'/node_modules/amdefine')(module, VVVVContext.getRelativeRequire(require)) }

define(function(require,exports) {


var $ = require('jquery');
require('d3');
var VVVV = require('core/vvvv.core.defines');
var Makros = require('vvvv.makros');

var UIState = {
  'Idle': 0,
  'Connecting': 1,
  'Moving': 2,
  'Creating': 3,
  'Changing': 4,
  'AreaSelecting': 5,
  'PinDragging': 6,
  'Resizing': 7
}

function getAllUpstreamNodes(origin_node, node) {
  if (node==undefined)
    node = origin_node;
  var upnodes = [];
  var u = node.getUpstreamNodes();
  for (var j=0; j<u.length; j++) {
    if (u[j]!=origin_node && !u[j].delays_output) {
      upnodes.push(u[j]);
      upnodes = upnodes.concat(getAllUpstreamNodes(origin_node, u[j]));
    }
  }
  return upnodes;
}

function getAllDownstreamNodes(origin_node, node) {
  if (node==undefined)
    node = origin_node;
  var upnodes = [];
  var u = node.getDownstreamNodes();
  for (var j=0; j<u.length; j++) {
    if (u[j]!=origin_node && !u[j].delays_output) {
      upnodes.push(u[j]);
      upnodes = upnodes.concat(getAllDownstreamNodes(origin_node, u[j]));
    }
  }
  return upnodes;
}

var defaultOpacity = 0.85;
var blurredOpacity = 0.35;

VVVV.PinTypes.Value.makeLabel = VVVV.PinTypes.String.makeLabel = function(element, node) {
  var rowCount = node.IOBoxRows();
  var sliceCount = node.IOBoxInputPin().getSliceCount();
  /*d3.select(element)
  .append('svg:clipPath')
    .attr('id', 'clip-path-'+node.id)
    .append("svg:rect")
      .attr('width', node.getWidth())
      .attr('height', node.getHeight())*/

  d3.select(element).selectAll('.vvvv-node-label').remove();
  for (var i=0; i<rowCount; i++) {
    d3.select(element)
    .append('svg:text')
      .text(node.IOBoxInputPin().getValue(i))
      .attr('class', 'vvvv-node-label')
      .attr('shape-rendering', 'crispEdges')
      .attr('dy', function(d) {
        return i*12+12;
      })
      .attr('dx', 4)
      .attr('font-size', 10)
      .attr('font-family', "'Lucida Sans Unicode', sans-serif")
      //.attr('clip-path', 'url(#clip-path-'+node.id+')')
  }
}

VVVV.PinTypes.Value.openInputBox = VVVV.PinTypes.String.openInputBox = function(win, $element, pin, sliceIdx) {
  $inputbox = $("<input type='text' value='"+pin.getValue(sliceIdx).toString().replace(/\|/g, "||").replace(/'/g, '&apos;').replace(/</g, '&lt;').replace(/>/g, '&gt;')+"' class='pininputbox value resettable'/>");
  $inputbox.css('position', $element.css('position'));
  $inputbox.css('width', $element.css('width'));
  $inputbox.css('height', $element.css('height'));
  $inputbox.css('left', $element.css('left'));
  $inputbox.css('top', $element.css('top'));
  $element.replaceWith($inputbox);
  $inputbox.get(0).select();

  win.window.document.exitPointerLock = win.window.document.exitPointerLock    ||
                                        win.window.document.mozExitPointerLock ||
                                        win.window.document.webkitExitPointerLock;

  $inputbox.change(function() {
    if (pin.typeName=="Value")
      pin.setValue(sliceIdx, parseFloat($(this).val()));
    else
      pin.setValue(sliceIdx, $(this).val());
    var cmd = {syncmode: 'diff', nodes: {}, links: []};
    cmd.nodes[pin.node.id] = {pins: {}};
    cmd.nodes[pin.node.id].pins[pin.pinname] = {values: pin.values};
    pin.node.parentPatch.editor.update(pin.node.parentPatch, cmd);
    //pin.node.parentPatch.afterUpdate();
  });
  $inputbox.keydown(function(e) {
    if (e.which==13) {
      $(this).change();
      $(this).remove();
    }
    e.stopPropagation();
  });

  if (pin.typeName=='Value') {
    function scroll(el, delta, e) {
      var mod = $(el).val()%1;
      if (!isNaN(mod)) {
        var offset;
        offset = 1;
        if (e.altKey || mod!==0)
          offset = 1.0/100.0;
        delta *= offset;
        $(el).val(parseFloat($(el).val())+delta);
        $(el).change();
      }
    }
{'fraction_non_alphanumeric': 0.20250340810509357, 'fraction_numerical': 0.009914487544925021, 'mean_word_length': 3.338709677419355, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3854189', 'n_tokens_mistral': 2951, 'n_tokens_neox': 2858, 'n_words': 466}