<commit_before>import * as R from 'ramda';
import React from 'react';
import { HotKeys } from 'react-hotkeys';

import * as XP from 'xod-project';

import { SELECTION_ENTITY_TYPE } from '../../../constants';

import PatchSVG from '../../../../project/components/PatchSVG';
import * as Layers from '../../../../project/components/layers';

import selectingMode from './selecting';
import { bindApi, getOffsetMatrix } from '../modeUtils';

const debuggingMode = R.merge(selectingMode, {
  onNodeDoubleClick(api, nodeId, patchPath) {
    if (patchPath === XP.NOT_IMPLEMENTED_IN_XOD_PATH) {
      api.props.actions.openImplementationEditor();
    } else if (XP.isConstantNodeType(patchPath) || XP.isTweakPath(patchPath)) {
      api.props.actions.focusBoundValue(nodeId, api.props.patchPath);
    } else {
      api.props.actions.drillDown(patchPath, nodeId);
    }
  },
  render(api) {
    return (
      <HotKeys
        handlers={this.getHotkeyHandlers(api)}
        className="PatchWrapper"
        onKeyDown={bindApi(api, this.onKeyDown)}
      >
        <PatchSVG
          onMouseDown={bindApi(api, this.onMouseDown)}
          onMouseMove={bindApi(api, this.onMouseMove)}
          onMouseUp={bindApi(api, this.onMouseUp)}
          svgRef={svg => api.setStorage({ patchSvgRef: svg })}
        >
          <Layers.Background
            width={api.props.size.width}
            height={api.props.size.height}
            onClick={bindApi(api, this.onBackgroundClick)}
            onDoubleClick={bindApi(api, this.onBackgroundDoubleClick)}
            onMouseDown={bindApi(api, this.onBackgroundMouseDown)}
            offset={api.getOffset()}
          />
          <g transform={getOffsetMatrix(api.getOffset())}>
            <Layers.Comments<commit_msg>tweak(xod-client): make double-clicking on a node consistent between selecting and debugging modes<commit_after>import * as R from 'ramda';
import React from 'react';
import { HotKeys } from 'react-hotkeys';

import * as XP from 'xod-project';

import { SELECTION_ENTITY_TYPE } from '../../../constants';

import PatchSVG from '../../../../project/components/PatchSVG';
import * as Layers from '../../../../project/components/layers';

import selectingMode from './selecting';
import { bindApi, getOffsetMatrix } from '../modeUtils';

const debuggingMode = R.merge(selectingMode, {
  onNodeDoubleClick(api, nodeId, patchPath) {
    if (R.contains(patchPath, R.keys(XP.MANAGED_ATTACHMENT_FILENAMES))) {
      api.props.actions.openAttachmentEditor(patchPath);
    } else if (
      XP.isConstantNodeType(patchPath) ||
      XP.isTweakPath(patchPath) ||
      XP.isBindableCustomType(patchPath)
    ) {
      api.props.actions.focusBoundValue(nodeId, api.props.patchPath);
    } else if (
      XP.isBusPatchPath(patchPath) ||
      XP.isTerminalPatchPath(patchPath)
    ) {
      api.props.actions.focusLabel(nodeId, api.props.patchPath);
    } else {
      api.props.actions.drillDown(patchPath, nodeId);
    }
  },
  render(api) {
    return (
      <HotKeys
        handlers={this.getHotkeyHandlers(api)}
        className="PatchWrapper"
        onKeyDown={bindApi(api, this.onKeyDown)}
      >
        <PatchSVG
          onMouseDown={bindApi(api, this.onMouseDown)}
          onMouseMove={bindApi(api, this.onMouseMove)}
          onMouseUp={bindApi(api, this.onMouseUp)}
          svgRef={svg => api.setStorage({ patchSvgRef: svg })}
        >
          <Layers.Background
            width={api.props.size.width}
            height={api.props.size.height}
            onClick={bindApi(api, this.onBackgroundClick)}
            onDoubleClick={bindApi(api, this.onBackgroundDoubleClick)}
            onMouseDown={bindApi(api, this.onBackgroundMouseDown)}
            offset={api.getOffset()}
          />
          <g transform={getOffsetMatrix(api.getOffset())}>
            <Layers.Comments
{'fraction_non_alphanumeric': 0.13929961089494164, 'fraction_numerical': 0.0, 'mean_word_length': 2.902834008097166, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, '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': '2276894', 'n_tokens_mistral': 1188, 'n_tokens_neox': 1179, 'n_words': 197}