How to use the ve-range-utils/lib.normalizePositionByRangeLength function in ve-range-utils

To help you get started, we’ve selected a few ve-range-utils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github TeselaGen / openVectorEditor / src / DigestTool / DigestContainer.js View on Github external
pairs.forEach(([cut1, cut2]) => {
      const start = normalizePositionByRangeLength(
        cut1.topSnipPosition,
        sequenceLength
      );
      const end = normalizePositionByRangeLength(
        cut2.topSnipPosition - 1,
        sequenceLength
      );
      const size = getRangeLength({ start, end }, sequenceLength);

      // const id = uniqid()
      const id = start + "-" + end + "-" + size + "-";
      getRangeLength({ start, end }, sequenceLength);
      fragments.push({
        cut1,
        cut2,
        start,
github TeselaGen / openVectorEditor / src / DigestTool / DigestContainer.js View on Github external
pairs.forEach(([cut1, cut2]) => {
      const start = normalizePositionByRangeLength(
        cut1.topSnipPosition,
        sequenceLength
      );
      const end = normalizePositionByRangeLength(
        cut2.topSnipPosition - 1,
        sequenceLength
      );
      const size = getRangeLength({ start, end }, sequenceLength);

      // const id = uniqid()
      const id = start + "-" + end + "-" + size + "-";
      getRangeLength({ start, end }, sequenceLength);
      fragments.push({
        cut1,
        cut2,
        start,
        end,
        size,
        id,
        onFragmentSelect: () => {
github TeselaGen / openVectorEditor / src / selectors / translationsSelector.js View on Github external
(acc, isActive, frameName) => {
        const frameOffset = Number(frameName);
        if (isActive) {
          const id = uuid();
          acc[id] = {
            id,
            start: 0 + Math.abs(frameOffset) - 1,
            end: normalizePositionByRangeLength(
              sequence.length - 1 + Math.abs(frameOffset) - 1,
              sequence.length
            ),
            translationType: "Frame",
            forward: frameOffset > 0,
            isOrf: true //pass isOrf = true here in order to not have it show up in the properties window
          };
        }
        return acc;
      },
      {}