@teselagen/ove 0.7.28 → 0.7.30-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CreateAnnotationsPage.d.ts +4 -3
- package/README.md +1 -1
- package/fileUtils.d.ts +12 -0
- package/html2canvas.esm--JN4fLQL.js +7891 -0
- package/html2canvas.esm-B7d7VJmQ.cjs +7891 -0
- package/index.cjs.js +1305 -1121
- package/index.es.js +1305 -1121
- package/index.umd.js +189161 -0
- package/ove.css +17 -4
- package/package.json +5 -9
- package/redux/findTool.d.ts +1 -0
- package/selectors/searchLayersSelector.d.ts +1 -1
- package/src/AutoAnnotate.js +1 -1
- package/src/CreateAnnotationsPage.js +1 -2
- package/src/Editor/style.css +8 -3
- package/src/FindBar/index.js +32 -1
- package/src/RowItem/SelectionLayer/index.js +42 -4
- package/src/RowItem/SelectionLayer/style.css +8 -0
- package/src/fileUtils.js +103 -0
- package/src/helperComponents/PropertiesDialog/TranslationProperties.js +1 -1
- package/src/redux/findTool.js +9 -0
- package/src/selectors/searchLayersSelector.js +40 -2
- package/style.css +12098 -1
- package/AASliver.js +0 -187
- package/AddLaddersDialog.js +0 -82
- package/AdditionalCutsiteInfoDialog.js +0 -599
- package/AlignmentVisibilityTool.js +0 -105
- package/AnnotationContainerHolder.js +0 -20
- package/AnnotationPositioner.js +0 -27
- package/AutoAnnotate.js +0 -501
- package/AutoAnnotateBpMatchingDialog.js +0 -208
- package/Axis.js +0 -151
- package/AxisNumbers.js +0 -35
- package/Browser.js +0 -106
- package/Caret.js +0 -63
- package/Chromatogram.js +0 -293
- package/CircularDnaSequence.js +0 -73
- package/CircularZoomMinimap.js +0 -16
- package/ColorPicker.js +0 -30
- package/CommandHotkeyHandler.js +0 -44
- package/CreateAnnotationsPage.js +0 -98
- package/Cutsite.js +0 -18
- package/CutsiteProperties.js +0 -176
- package/CutsiteSelectionLayers.js +0 -47
- package/Cutsites.js +0 -271
- package/DeletionLayer.js +0 -28
- package/DropHandler.css +0 -21
- package/DropHandler.js +0 -64
- package/EditCaretPosition.js +0 -234
- package/EditTrackNameDialog.js +0 -30
- package/Feature.js +0 -83
- package/FeatureProperties.js +0 -6
- package/FillWindow.js +0 -47
- package/GenbankView.js +0 -74
- package/GeneralProperties.js +0 -117
- package/GenericAnnotationProperties.js +0 -406
- package/GlobalDialog.js +0 -73
- package/GlobalDialogUtils.js +0 -110
- package/GoToDialog.js +0 -25
- package/HorizontalPanelDragHandle.js +0 -35
- package/Keyboard.js +0 -85
- package/Labels.js +0 -327
- package/Ladder.css +0 -20
- package/Ladder.js +0 -303
- package/MeltingTemp.js +0 -85
- package/Menlo.ttf +0 -0
- package/Minimap.js +0 -515
- package/Mismatches.js +0 -134
- package/Monaco.ttf +0 -0
- package/MultipleSeqsDetectedOnImportDialog.js +0 -74
- package/Orf.js +0 -109
- package/OrfProperties.js +0 -117
- package/Orfs.js +0 -35
- package/PCRTool.js +0 -179
- package/PairwiseAlignmentView.js +0 -68
- package/Part.js +0 -34
- package/PartProperties.js +0 -9
- package/PassThrough.js +0 -3
- package/PerformantSelectionLayer.js +0 -32
- package/PinchHelper.js +0 -24
- package/PointedAnnotation.js +0 -347
- package/PositionAnnotationOnCircle.js +0 -26
- package/Primer.js +0 -41
- package/PrimerProperties.js +0 -19
- package/ReflexContainer.js +0 -802
- package/ReflexElement.js +0 -160
- package/ReflexEvents.js +0 -77
- package/ReflexSplitter.js +0 -205
- package/RenameSequenceDialog.js +0 -7
- package/RotateCircularViewSlider.js +0 -93
- package/SelectDialog.js +0 -150
- package/SequenceName.js +0 -15
- package/SimpleCircularOrLinearView.js +0 -381
- package/SimpleOligoPreview.js +0 -39
- package/SingleEnzymeCutsiteInfo.js +0 -139
- package/ToolbarItem.js +0 -192
- package/Translation.js +0 -198
- package/TranslationProperties.js +0 -149
- package/UncontrolledSliderWithPlusMinusBtns.css +0 -5
- package/UncontrolledSliderWithPlusMinusBtns.js +0 -134
- package/VeTopRightContainer.js +0 -12
- package/ZoomCircularViewSlider.js +0 -62
- package/ZoomLinearView.js +0 -47
- package/addAlignment.js +0 -6
- package/addMetaToActionCreators.js +0 -12
- package/addWrappedAddons.js +0 -20
- package/alignmentTool.js +0 -503
- package/alignments.js +0 -379
- package/annotationLabelVisibility.js +0 -2
- package/annotationSearchSelector.js +0 -24
- package/annotationTypes.js +0 -35
- package/annotationVisibility.js +0 -196
- package/annotationsToSupport.js +0 -104
- package/arrayToObjWithIds.js +0 -17
- package/arrayUtils.js +0 -19
- package/array_move.js +0 -10
- package/calculateTickMarkPositionsForGivenRange.js +0 -47
- package/caretPosition.js +0 -27
- package/cdsFeaturesSelector.js +0 -9
- package/charWidth.js +0 -22
- package/circular.js +0 -19
- package/circularSelector.js +0 -4
- package/clickAndDragUtils.js +0 -576
- package/coerceInitialValue.js +0 -7
- package/combineReducersDontIgnoreKeys.js +0 -12
- package/commandUtils.js +0 -20
- package/constants.js +0 -2
- package/copyOptions.js +0 -34
- package/createFragmentLines.js +0 -120
- package/createMergedDefaultStateReducer.js +0 -30
- package/createMetaAction.js +0 -12
- package/createSequenceInputPopup.js +0 -290
- package/createSequenceInputPopupStyle.css +0 -87
- package/createSimpleDialog.js +0 -89
- package/createYourOwnEnzyme.js +0 -39
- package/cutsiteLabelColorSelector.js +0 -6
- package/cutsiteTool.js +0 -88
- package/cutsitesByRangeSelector.js +0 -5
- package/cutsitesSelector.js +0 -61
- package/darkmode.css +0 -98
- package/defaultConfig.js +0 -150
- package/deletionLayers.js +0 -36
- package/description.js +0 -21
- package/digestTool.js +0 -34
- package/dnaToColor.js +0 -17
- package/downloadTool.js +0 -39
- package/draggableClassnames.js +0 -5
- package/drawAnnotations.js +0 -440
- package/drawDirectedPiePiece.js +0 -142
- package/editTool.js +0 -49
- package/editorSelector.js +0 -2
- package/editorUtils.js +0 -205
- package/estimateRowHeight.js +0 -184
- package/featureLengthsToHide.js +0 -27
- package/featureTool.js +0 -34
- package/features.js +0 -19
- package/featuresSelector.js +0 -8
- package/filteredCutsitesSelector.js +0 -136
- package/filteredFeaturesSelector.js +0 -32
- package/filteredPartsSelector.js +0 -57
- package/filteredPrimersSelector.js +0 -27
- package/filteredRestrictionEnzymesSelector.js +0 -1
- package/find.png +0 -0
- package/findTool.js +0 -79
- package/findToolConstants.js +0 -1
- package/frameTranslations.js +0 -52
- package/fullscreen.png +0 -0
- package/getAdditionalEnzymesSelector.js +0 -46
- package/getAngleForPositionMidpoint.js +0 -3
- package/getAnnotationClassnames.js +0 -12
- package/getAnnotationNameAndStartStopString.js +0 -61
- package/getBpsPerRow.js +0 -19
- package/getCutsiteLabelHeights.js +0 -56
- package/getGapMap.js +0 -12
- package/getGaps.js +0 -27
- package/getInternalLabel.js +0 -40
- package/getOveHotkeyDefs.js +0 -12
- package/getPairwiseOverviewLinearViewOptions.js +0 -38
- package/getRangeAnglesSpecial.js +0 -12
- package/getStructuredBases.js +0 -97
- package/getTrackFromEvent.js +0 -25
- package/getVisibleStartEnd.js +0 -7
- package/getXStartAndWidthFromNonCircularRange.js +0 -12
- package/getXStartAndWidthOfRangeWrtRow.js +0 -27
- package/getXStartAndWidthOfRowAnnotation.js +0 -19
- package/getYOffset.js +0 -15
- package/hoveredAnnotation.js +0 -24
- package/importTool.js +0 -27
- package/index.js +0 -71
- package/inlineFindTool.js +0 -38
- package/isElementInViewport.js +0 -29
- package/isEnzymeFilterAndSelector.js +0 -1
- package/isTargetWithinEl.js +0 -6
- package/labelLineIntensity.js +0 -25
- package/labelSize.js +0 -23
- package/ladderDefaults.js +0 -25
- package/lastSavedId.js +0 -20
- package/lineageLines.js +0 -11
- package/linear.png +0 -0
- package/makeStore.js +0 -34
- package/massageTickSpacing.js +0 -19
- package/materiallyAvailable.js +0 -19
- package/middleware.js +0 -112
- package/minimumOrfSize.js +0 -24
- package/minimumOrfSizeSelector.js +0 -2
- package/modalActions.js +0 -3
- package/moveCaret.js +0 -58
- package/name.js +0 -19
- package/normalizeAngle.js +0 -3
- package/normalizeAngleRange.js +0 -9
- package/oligoTool.js +0 -30
- package/onlyUpdateForKeysDeep.js +0 -31
- package/orfFrameToColorMap.js +0 -10
- package/orfTool.js +0 -136
- package/orfsSelector.js +0 -15
- package/panelsShown.js +0 -294
- package/partLengthsToHide.js +0 -23
- package/partOverhangs.js +0 -6
- package/partTagSearch.js +0 -69
- package/partTool.js +0 -45
- package/parts.js +0 -19
- package/partsSelector.js +0 -8
- package/pie.png +0 -0
- package/polarToSpecialCartesian.js +0 -7
- package/positionCutsites.js +0 -6
- package/prepareRowData.js +0 -64
- package/primerBases.js +0 -221
- package/primerLengthsToHide.js +0 -27
- package/primers.js +0 -19
- package/primersSelector.js +0 -8
- package/print.png +0 -0
- package/printTool.js +0 -31
- package/propertiesTool.js +0 -40
- package/proteinUtils.js +0 -3
- package/pureNoFunc.js +0 -18
- package/readOnly.js +0 -25
- package/redoTool.js +0 -30
- package/reflex-styles.css +0 -128
- package/reflex-styles.css.map +0 -9
- package/relaxLabelAngles.js +0 -157
- package/relaxLabels_DEPRECATED.js +0 -105
- package/replacementLayers.js +0 -36
- package/restrictionEnzymes.js +0 -52
- package/restrictionEnzymesSelector.js +0 -34
- package/rowviewContants.js +0 -3
- package/ruler.css +0 -89
- package/save.png +0 -0
- package/saveTool.js +0 -44
- package/searchLayersSelector.js +0 -71
- package/selectedAnnotations.js +0 -89
- package/selectedAnnotationsSelector.js +0 -1
- package/selectedCutsitesSelector.js +0 -21
- package/selectedPartTags.js +0 -21
- package/selectionLayer.js +0 -25
- package/sequence.js +0 -12
- package/sequenceDataHistory.js +0 -43
- package/sequenceDataSelector.js +0 -2
- package/sequenceLengthSelector.js +0 -5
- package/sequenceSelector.js +0 -4
- package/sharedActionCreators.js +0 -0
- package/shouldFlipText.js +0 -4
- package/shouldRerender.js +0 -27
- package/showFileDialog.js +0 -25
- package/showGCContent.js +0 -23
- package/show_cut_sites.png +0 -0
- package/show_features.png +0 -0
- package/show_orfs.png +0 -0
- package/show_primers.png +0 -0
- package/simpleDialog.css +0 -13
- package/specialCutsiteFilterOptions.js +0 -22
- package/tagsToBoldSelector.js +0 -2
- package/toggle_views.svg +0 -1
- package/toolBar.js +0 -23
- package/translationSearchMatchesSelector.js +0 -14
- package/translations.js +0 -20
- package/translationsRawSelector.js +0 -8
- package/translationsSelector.js +0 -137
- package/typeField.js +0 -24
- package/undoTool.js +0 -30
- package/updateEditor.js +0 -200
- package/updateLabelsForInViewFeatures.js +0 -55
- package/updateLabelsForInViewFeaturesCircView.js +0 -41
- package/updateTrackHelper.js +0 -58
- package/uppercaseSequenceMapFont.js +0 -25
- package/upsertDeleteActionGenerator.js +0 -31
- package/useAAColorType.js +0 -8
- package/useAdditionalOrfStartCodons.js +0 -24
- package/useAnnotationLimits.js +0 -42
- package/useChromatogramPrefs.js +0 -31
- package/useFormValue.js +0 -7
- package/useLadders.js +0 -6
- package/useMeltingTemp.js +0 -7
- package/useTmType.js +0 -10
- package/userDefinedHandlersAndOpts.js +0 -61
- package/utils.js +0 -37
- package/versionHistory.js +0 -26
- package/versionHistoryTool.js +0 -21
- package/viewSubmenu.js +0 -479
- package/visibilityTool.js +0 -39
- package/withHover.js +0 -113
- package/withRestrictionEnzymes.js +0 -15
package/clickAndDragUtils.js
DELETED
|
@@ -1,576 +0,0 @@
|
|
|
1
|
-
import { noop } from "lodash-es";
|
|
2
|
-
import {
|
|
3
|
-
getRangeLength,
|
|
4
|
-
trimRangeByAnotherRange,
|
|
5
|
-
trimNumberToFitWithin0ToAnotherNumber,
|
|
6
|
-
normalizePositionByRangeLength,
|
|
7
|
-
expandOrContractRangeToPosition
|
|
8
|
-
} from "@teselagen/range-utils";
|
|
9
|
-
|
|
10
|
-
let dragInProgress = false;
|
|
11
|
-
let selectionStartOrEndGrabbed;
|
|
12
|
-
|
|
13
|
-
let caretPositionOnDragStart;
|
|
14
|
-
export const editorDragged = function ({
|
|
15
|
-
nearestCaretPos,
|
|
16
|
-
doNotWrapOrigin,
|
|
17
|
-
caretPosition = -1,
|
|
18
|
-
easyStore,
|
|
19
|
-
caretPositionUpdate = noop,
|
|
20
|
-
selectionLayerUpdate = noop,
|
|
21
|
-
selectionLayer = { start: -1, end: -1 },
|
|
22
|
-
sequenceLength
|
|
23
|
-
}) {
|
|
24
|
-
if (easyStore && easyStore.selectionLayer) {
|
|
25
|
-
caretPosition = easyStore.caretPosition;
|
|
26
|
-
selectionLayer = easyStore.selectionLayer;
|
|
27
|
-
}
|
|
28
|
-
if (!dragInProgress) {
|
|
29
|
-
//we're starting the drag, so update the caret position!
|
|
30
|
-
dragInProgress = new Date().getTime();
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
if (selectionLayer.start > -1 && selectionStartOrEndGrabbed === "start") {
|
|
35
|
-
handleSelectionStartGrabbed({
|
|
36
|
-
caretPosition,
|
|
37
|
-
selectionLayer,
|
|
38
|
-
caretPositionUpdate: caretPositionUpdate,
|
|
39
|
-
selectionLayerUpdate: selectionLayerUpdate,
|
|
40
|
-
nearestCaretPos,
|
|
41
|
-
sequenceLength,
|
|
42
|
-
doNotWrapOrigin
|
|
43
|
-
});
|
|
44
|
-
} else if (
|
|
45
|
-
selectionLayer.start > -1 &&
|
|
46
|
-
selectionStartOrEndGrabbed === "end"
|
|
47
|
-
) {
|
|
48
|
-
handleSelectionEndGrabbed({
|
|
49
|
-
caretPosition,
|
|
50
|
-
selectionLayer,
|
|
51
|
-
caretPositionUpdate: caretPositionUpdate,
|
|
52
|
-
selectionLayerUpdate: selectionLayerUpdate,
|
|
53
|
-
nearestCaretPos,
|
|
54
|
-
sequenceLength,
|
|
55
|
-
doNotWrapOrigin
|
|
56
|
-
});
|
|
57
|
-
} else {
|
|
58
|
-
handleNoSelectionLayerYet({
|
|
59
|
-
caretPosition: caretPositionOnDragStart,
|
|
60
|
-
selectionLayer: caretPositionOnDragStart
|
|
61
|
-
? { start: -1, end: -1 }
|
|
62
|
-
: selectionLayer,
|
|
63
|
-
selectionLayerUpdate: selectionLayerUpdate,
|
|
64
|
-
nearestCaretPos,
|
|
65
|
-
sequenceLength,
|
|
66
|
-
doNotWrapOrigin
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
export const editorClicked = function ({
|
|
72
|
-
nearestCaretPos,
|
|
73
|
-
shiftHeld,
|
|
74
|
-
updateSelectionOrCaret
|
|
75
|
-
}) {
|
|
76
|
-
const timeDif = new Date().getTime() - dragInProgress;
|
|
77
|
-
if (!dragInProgress || 200 > timeDif) {
|
|
78
|
-
//if the drag is less than 200 ms it probably isn't a real drag!
|
|
79
|
-
//we're not dragging the caret or selection handles
|
|
80
|
-
updateSelectionOrCaret(shiftHeld, nearestCaretPos);
|
|
81
|
-
}
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
export const editorDragStarted = function (opts) {
|
|
85
|
-
document?.body.classList.add("sequenceDragging"); //needed to prevent the input bubble from losing focus post user drag
|
|
86
|
-
window.__veDragging = true;
|
|
87
|
-
|
|
88
|
-
caretPositionOnDragStart = opts.nearestCaretPos; //bump the drag counter
|
|
89
|
-
selectionStartOrEndGrabbed = opts.selectionStartGrabbed
|
|
90
|
-
? "start"
|
|
91
|
-
: opts.selectionEndGrabbed
|
|
92
|
-
? "end"
|
|
93
|
-
: null;
|
|
94
|
-
};
|
|
95
|
-
export const editorDragStopped = function () {
|
|
96
|
-
document.body.classList.remove("sequenceDragging"); //needed to prevent the input bubble from losing focus post user drag
|
|
97
|
-
window.__veDragging = false;
|
|
98
|
-
caretPositionOnDragStart = null;
|
|
99
|
-
setTimeout(function () {
|
|
100
|
-
dragInProgress = false;
|
|
101
|
-
});
|
|
102
|
-
};
|
|
103
|
-
|
|
104
|
-
export function handleCaretMoved({
|
|
105
|
-
moveBy,
|
|
106
|
-
circular,
|
|
107
|
-
sequenceLength,
|
|
108
|
-
caretPosition,
|
|
109
|
-
selectionLayer,
|
|
110
|
-
shiftHeld,
|
|
111
|
-
type,
|
|
112
|
-
caretPositionUpdate,
|
|
113
|
-
selectionLayerUpdate
|
|
114
|
-
}) {
|
|
115
|
-
let newCaretPosition;
|
|
116
|
-
if (selectionLayer.start > -1) {
|
|
117
|
-
if (shiftHeld) {
|
|
118
|
-
newCaretPosition = normalizeNewCaretPos(
|
|
119
|
-
Number(
|
|
120
|
-
(selectionLayer.cursorAtEnd
|
|
121
|
-
? selectionLayer.end + 1
|
|
122
|
-
: selectionLayer.start) + moveBy
|
|
123
|
-
),
|
|
124
|
-
sequenceLength,
|
|
125
|
-
circular
|
|
126
|
-
);
|
|
127
|
-
// newCaretPosition = normalizeNewCaretPos(Number(caretPosition + moveBy), sequenceLength, circular);
|
|
128
|
-
let anchorPos;
|
|
129
|
-
if (selectionLayer.start <= selectionLayer.end) {
|
|
130
|
-
//non-circular selection
|
|
131
|
-
//define an anchor pos
|
|
132
|
-
if (selectionLayer.cursorAtEnd) {
|
|
133
|
-
if (newCaretPosition === selectionLayer.start && moveBy < 0) {
|
|
134
|
-
return caretPositionUpdate(newCaretPosition);
|
|
135
|
-
}
|
|
136
|
-
anchorPos = selectionLayer.start;
|
|
137
|
-
} else {
|
|
138
|
-
if (newCaretPosition === selectionLayer.end + 1 && moveBy > 0) {
|
|
139
|
-
return caretPositionUpdate(newCaretPosition);
|
|
140
|
-
}
|
|
141
|
-
anchorPos = selectionLayer.end + 1;
|
|
142
|
-
}
|
|
143
|
-
if (newCaretPosition > anchorPos) {
|
|
144
|
-
if (circular && selectionLayer.start + moveBy < 0) {
|
|
145
|
-
//we've gone around the origin in this case
|
|
146
|
-
selectionLayerUpdate({
|
|
147
|
-
start: newCaretPosition,
|
|
148
|
-
end: anchorPos - 1,
|
|
149
|
-
cursorAtEnd: false
|
|
150
|
-
});
|
|
151
|
-
} else {
|
|
152
|
-
selectionLayerUpdate({
|
|
153
|
-
start: anchorPos,
|
|
154
|
-
end: normalizePositionByRangeLength(
|
|
155
|
-
newCaretPosition - 1,
|
|
156
|
-
sequenceLength
|
|
157
|
-
),
|
|
158
|
-
cursorAtEnd: true
|
|
159
|
-
});
|
|
160
|
-
}
|
|
161
|
-
} else {
|
|
162
|
-
if (circular && selectionLayer.end + moveBy >= sequenceLength) {
|
|
163
|
-
//we've gone around the origin in this case
|
|
164
|
-
selectionLayerUpdate({
|
|
165
|
-
start: anchorPos,
|
|
166
|
-
end: normalizePositionByRangeLength(
|
|
167
|
-
newCaretPosition - 1,
|
|
168
|
-
sequenceLength
|
|
169
|
-
),
|
|
170
|
-
cursorAtEnd: true
|
|
171
|
-
});
|
|
172
|
-
} else {
|
|
173
|
-
selectionLayerUpdate({
|
|
174
|
-
start: newCaretPosition,
|
|
175
|
-
end: normalizePositionByRangeLength(
|
|
176
|
-
anchorPos - 1,
|
|
177
|
-
sequenceLength
|
|
178
|
-
),
|
|
179
|
-
cursorAtEnd: false
|
|
180
|
-
});
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
} else {
|
|
184
|
-
//circular selection
|
|
185
|
-
if (selectionLayer.cursorAtEnd) {
|
|
186
|
-
anchorPos = selectionLayer.start;
|
|
187
|
-
} else {
|
|
188
|
-
anchorPos = selectionLayer.end + 1;
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
if (
|
|
192
|
-
(newCaretPosition <= anchorPos &&
|
|
193
|
-
!(!selectionLayer.cursorAtEnd && newCaretPosition - moveBy < 0)) || // if the move by is crossing the origin then we should make the new selection non circular
|
|
194
|
-
(selectionLayer.cursorAtEnd && selectionLayer.end + moveBy < 0)
|
|
195
|
-
) {
|
|
196
|
-
selectionLayerUpdate({
|
|
197
|
-
start: anchorPos,
|
|
198
|
-
end: normalizePositionByRangeLength(
|
|
199
|
-
newCaretPosition - 1,
|
|
200
|
-
sequenceLength
|
|
201
|
-
),
|
|
202
|
-
cursorAtEnd: true
|
|
203
|
-
});
|
|
204
|
-
} else {
|
|
205
|
-
selectionLayerUpdate({
|
|
206
|
-
start: normalizePositionByRangeLength(
|
|
207
|
-
newCaretPosition,
|
|
208
|
-
sequenceLength
|
|
209
|
-
),
|
|
210
|
-
end: normalizePositionByRangeLength(anchorPos - 1, sequenceLength),
|
|
211
|
-
cursorAtEnd: false
|
|
212
|
-
});
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
} else {
|
|
216
|
-
//no shiftHeld
|
|
217
|
-
//handle special cases
|
|
218
|
-
if (moveBy === 0) {
|
|
219
|
-
if (type === "moveCaretRightOne") {
|
|
220
|
-
return caretPositionUpdate(selectionLayer.end + 1);
|
|
221
|
-
} else if (type === "moveCaretLeftOne") {
|
|
222
|
-
return caretPositionUpdate(selectionLayer.start);
|
|
223
|
-
} else {
|
|
224
|
-
throw new Error("this case should not be hit...");
|
|
225
|
-
}
|
|
226
|
-
} else if (moveBy > 0) {
|
|
227
|
-
newCaretPosition = normalizeNewCaretPos(
|
|
228
|
-
Number(selectionLayer.end + moveBy),
|
|
229
|
-
sequenceLength,
|
|
230
|
-
circular
|
|
231
|
-
);
|
|
232
|
-
caretPositionUpdate(1);
|
|
233
|
-
} else {
|
|
234
|
-
newCaretPosition = normalizeNewCaretPos(
|
|
235
|
-
Number(selectionLayer.start + moveBy),
|
|
236
|
-
sequenceLength,
|
|
237
|
-
circular
|
|
238
|
-
);
|
|
239
|
-
caretPositionUpdate(newCaretPosition);
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
} else {
|
|
243
|
-
//no selection layer
|
|
244
|
-
newCaretPosition = normalizeNewCaretPos(
|
|
245
|
-
Number(caretPosition + moveBy),
|
|
246
|
-
sequenceLength,
|
|
247
|
-
circular
|
|
248
|
-
);
|
|
249
|
-
if (shiftHeld) {
|
|
250
|
-
if (moveBy > 0) {
|
|
251
|
-
if (newCaretPosition === caretPosition) {
|
|
252
|
-
caretPositionUpdate(newCaretPosition);
|
|
253
|
-
} else {
|
|
254
|
-
selectionLayerUpdate({
|
|
255
|
-
start: caretPosition,
|
|
256
|
-
end: normalizePositionByRangeLength(
|
|
257
|
-
newCaretPosition - 1,
|
|
258
|
-
sequenceLength
|
|
259
|
-
),
|
|
260
|
-
cursorAtEnd: true
|
|
261
|
-
});
|
|
262
|
-
}
|
|
263
|
-
} else {
|
|
264
|
-
//moving to the left
|
|
265
|
-
if (newCaretPosition === caretPosition) {
|
|
266
|
-
caretPositionUpdate(newCaretPosition);
|
|
267
|
-
} else {
|
|
268
|
-
selectionLayerUpdate({
|
|
269
|
-
start: newCaretPosition,
|
|
270
|
-
end: normalizePositionByRangeLength(
|
|
271
|
-
caretPosition - 1,
|
|
272
|
-
sequenceLength
|
|
273
|
-
),
|
|
274
|
-
cursorAtEnd: false
|
|
275
|
-
});
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
} else {
|
|
279
|
-
//no shiftHeld
|
|
280
|
-
caretPositionUpdate(newCaretPosition);
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
export function normalizeNewCaretPos(caretPosition, sequenceLength, circular) {
|
|
286
|
-
if (circular) {
|
|
287
|
-
return normalizePositionByRangeLength(caretPosition, sequenceLength, true);
|
|
288
|
-
} else {
|
|
289
|
-
return trimNumberToFitWithin0ToAnotherNumber(caretPosition, sequenceLength);
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
export function handleSelectionStartGrabbed({
|
|
294
|
-
caretPosition,
|
|
295
|
-
selectionLayer,
|
|
296
|
-
selectionLayerUpdate,
|
|
297
|
-
nearestCaretPos,
|
|
298
|
-
sequenceLength,
|
|
299
|
-
doNotWrapOrigin,
|
|
300
|
-
caretPositionUpdate
|
|
301
|
-
}) {
|
|
302
|
-
if (selectionLayer.start < 0) {
|
|
303
|
-
handleNoSelectionLayerYet({
|
|
304
|
-
caretPosition,
|
|
305
|
-
selectionLayer,
|
|
306
|
-
selectionLayerUpdate,
|
|
307
|
-
nearestCaretPos,
|
|
308
|
-
sequenceLength,
|
|
309
|
-
doNotWrapOrigin
|
|
310
|
-
});
|
|
311
|
-
} else {
|
|
312
|
-
if (
|
|
313
|
-
doNotWrapOrigin &&
|
|
314
|
-
selectionLayer.end > -1 &&
|
|
315
|
-
nearestCaretPos === selectionLayer.end + 1
|
|
316
|
-
) {
|
|
317
|
-
caretPositionUpdate(nearestCaretPos);
|
|
318
|
-
caretPositionOnDragStart = nearestCaretPos;
|
|
319
|
-
} else if (doNotWrapOrigin && nearestCaretPos > selectionLayer.end + 1) {
|
|
320
|
-
caretPositionOnDragStart = selectionLayer.end + 1;
|
|
321
|
-
selectionLayerUpdate({
|
|
322
|
-
start: selectionLayer.end + 1,
|
|
323
|
-
end: nearestCaretPos
|
|
324
|
-
});
|
|
325
|
-
selectionStartOrEndGrabbed = "end";
|
|
326
|
-
} else {
|
|
327
|
-
selectionStartOrEndGrabbed = "start";
|
|
328
|
-
//there must be a selection layer
|
|
329
|
-
//we need to move the selection layer
|
|
330
|
-
selectionLayerUpdate({
|
|
331
|
-
start: nearestCaretPos,
|
|
332
|
-
end: selectionLayer.end
|
|
333
|
-
});
|
|
334
|
-
}
|
|
335
|
-
}
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
export function handleSelectionEndGrabbed({
|
|
339
|
-
caretPosition,
|
|
340
|
-
selectionLayer,
|
|
341
|
-
selectionLayerUpdate,
|
|
342
|
-
nearestCaretPos,
|
|
343
|
-
sequenceLength,
|
|
344
|
-
doNotWrapOrigin,
|
|
345
|
-
caretPositionUpdate
|
|
346
|
-
}) {
|
|
347
|
-
if (selectionLayer.start < 0) {
|
|
348
|
-
handleNoSelectionLayerYet({
|
|
349
|
-
caretPosition,
|
|
350
|
-
selectionLayerUpdate,
|
|
351
|
-
nearestCaretPos,
|
|
352
|
-
sequenceLength,
|
|
353
|
-
doNotWrapOrigin
|
|
354
|
-
});
|
|
355
|
-
} else {
|
|
356
|
-
if (
|
|
357
|
-
doNotWrapOrigin &&
|
|
358
|
-
selectionLayer.start > -1 &&
|
|
359
|
-
nearestCaretPos === selectionLayer.start
|
|
360
|
-
) {
|
|
361
|
-
caretPositionUpdate(nearestCaretPos);
|
|
362
|
-
caretPositionOnDragStart = nearestCaretPos;
|
|
363
|
-
} else if (doNotWrapOrigin && nearestCaretPos < selectionLayer.start) {
|
|
364
|
-
selectionLayerUpdate({
|
|
365
|
-
start: nearestCaretPos,
|
|
366
|
-
end: selectionLayer.start - 1
|
|
367
|
-
});
|
|
368
|
-
caretPositionOnDragStart = selectionLayer.start;
|
|
369
|
-
selectionStartOrEndGrabbed = "start";
|
|
370
|
-
} else {
|
|
371
|
-
selectionStartOrEndGrabbed = "end";
|
|
372
|
-
//there must be a selection layer
|
|
373
|
-
//we need to move the selection layer
|
|
374
|
-
const newEnd = Math.min(nearestCaretPos - 1, sequenceLength - 1);
|
|
375
|
-
selectionLayerUpdate({
|
|
376
|
-
start: selectionLayer.start,
|
|
377
|
-
end: newEnd,
|
|
378
|
-
cursorAtEnd: true
|
|
379
|
-
});
|
|
380
|
-
}
|
|
381
|
-
}
|
|
382
|
-
}
|
|
383
|
-
export function handleNoSelectionLayerYet({
|
|
384
|
-
caretPosition,
|
|
385
|
-
selectionLayerUpdate,
|
|
386
|
-
nearestCaretPos,
|
|
387
|
-
sequenceLength,
|
|
388
|
-
doNotWrapOrigin
|
|
389
|
-
}) {
|
|
390
|
-
//no selection layer yet, so we'll start one if necessary
|
|
391
|
-
// 0 1 2 3 4 5 6 7 8 9
|
|
392
|
-
// c
|
|
393
|
-
// n
|
|
394
|
-
//
|
|
395
|
-
|
|
396
|
-
const dragEnd = {
|
|
397
|
-
start: caretPosition,
|
|
398
|
-
end: normalizePositionByRangeLength(
|
|
399
|
-
nearestCaretPos - 1,
|
|
400
|
-
sequenceLength,
|
|
401
|
-
true
|
|
402
|
-
)
|
|
403
|
-
};
|
|
404
|
-
const dragStart = {
|
|
405
|
-
start: nearestCaretPos,
|
|
406
|
-
end: normalizePositionByRangeLength(caretPosition - 1, sequenceLength, true)
|
|
407
|
-
};
|
|
408
|
-
if (caretPosition === nearestCaretPos) {
|
|
409
|
-
return; // do nothing because nearestCaretPos === caretPosition
|
|
410
|
-
} else if (
|
|
411
|
-
(doNotWrapOrigin && caretPosition < nearestCaretPos) ||
|
|
412
|
-
(!doNotWrapOrigin &&
|
|
413
|
-
getRangeLength(dragEnd, sequenceLength) <
|
|
414
|
-
getRangeLength(dragStart, sequenceLength))
|
|
415
|
-
) {
|
|
416
|
-
selectionStartOrEndGrabbed = "end";
|
|
417
|
-
selectionLayerUpdate(dragEnd);
|
|
418
|
-
caretPositionOnDragStart = null;
|
|
419
|
-
} else {
|
|
420
|
-
selectionStartOrEndGrabbed = "start";
|
|
421
|
-
selectionLayerUpdate(dragStart);
|
|
422
|
-
caretPositionOnDragStart = null;
|
|
423
|
-
}
|
|
424
|
-
}
|
|
425
|
-
|
|
426
|
-
export function updateSelectionOrCaret({
|
|
427
|
-
shiftHeld,
|
|
428
|
-
sequenceLength,
|
|
429
|
-
newRangeOrCaret,
|
|
430
|
-
caretPosition,
|
|
431
|
-
selectionLayer,
|
|
432
|
-
selectionLayerUpdate = noop,
|
|
433
|
-
caretPositionUpdate = noop,
|
|
434
|
-
doNotWrapOrigin
|
|
435
|
-
}) {
|
|
436
|
-
let newCaret;
|
|
437
|
-
let newRange;
|
|
438
|
-
if (typeof newRangeOrCaret !== "object") {
|
|
439
|
-
newCaret = newRangeOrCaret;
|
|
440
|
-
} else {
|
|
441
|
-
newRange = {
|
|
442
|
-
isFromRowView: newRangeOrCaret.isFromRowView,
|
|
443
|
-
start: newRangeOrCaret.start,
|
|
444
|
-
end: newRangeOrCaret.end,
|
|
445
|
-
forward: newRangeOrCaret.forward,
|
|
446
|
-
forceUpdate: newRangeOrCaret.forceUpdate,
|
|
447
|
-
overlapsSelf: newRangeOrCaret.overlapsSelf,
|
|
448
|
-
isWrappedAddon: newRangeOrCaret.isWrappedAddon
|
|
449
|
-
};
|
|
450
|
-
}
|
|
451
|
-
if (shiftHeld) {
|
|
452
|
-
if (caretPosition > 0) {
|
|
453
|
-
//there is a caret already down
|
|
454
|
-
if (newCaret > -1) {
|
|
455
|
-
//a new caret is being passed
|
|
456
|
-
handleNoSelectionLayerYet({
|
|
457
|
-
caretPosition,
|
|
458
|
-
selectionLayer,
|
|
459
|
-
selectionLayerUpdate,
|
|
460
|
-
nearestCaretPos: newCaret,
|
|
461
|
-
sequenceLength,
|
|
462
|
-
doNotWrapOrigin
|
|
463
|
-
});
|
|
464
|
-
} else {
|
|
465
|
-
simpleUpdate();
|
|
466
|
-
}
|
|
467
|
-
} else if (selectionLayer.start > -1) {
|
|
468
|
-
//there is already a selection layer
|
|
469
|
-
if (newCaret > -1) {
|
|
470
|
-
//new caret passed
|
|
471
|
-
const distanceFromStart = getMinRangeLength(
|
|
472
|
-
selectionLayer.start,
|
|
473
|
-
newCaret,
|
|
474
|
-
sequenceLength,
|
|
475
|
-
doNotWrapOrigin
|
|
476
|
-
);
|
|
477
|
-
const distanceFromEnd = getMinRangeLength(
|
|
478
|
-
selectionLayer.end,
|
|
479
|
-
newCaret,
|
|
480
|
-
sequenceLength,
|
|
481
|
-
doNotWrapOrigin
|
|
482
|
-
);
|
|
483
|
-
if (distanceFromStart < distanceFromEnd) {
|
|
484
|
-
selectionLayerUpdate({
|
|
485
|
-
start: newCaret,
|
|
486
|
-
end: selectionLayer.end
|
|
487
|
-
});
|
|
488
|
-
} else {
|
|
489
|
-
selectionLayerUpdate({
|
|
490
|
-
start: selectionLayer.start,
|
|
491
|
-
end: normalizePositionByRangeLength(
|
|
492
|
-
newCaret - 1,
|
|
493
|
-
sequenceLength,
|
|
494
|
-
true
|
|
495
|
-
)
|
|
496
|
-
});
|
|
497
|
-
}
|
|
498
|
-
} else {
|
|
499
|
-
//new range passed
|
|
500
|
-
// return selectionLayerUpdate(newRange);
|
|
501
|
-
const selectionFullyContained = !trimRangeByAnotherRange(
|
|
502
|
-
selectionLayer,
|
|
503
|
-
newRange
|
|
504
|
-
);
|
|
505
|
-
if (selectionFullyContained) {
|
|
506
|
-
return selectionLayerUpdate(newRange);
|
|
507
|
-
}
|
|
508
|
-
|
|
509
|
-
const newRangeFullyContained = !trimRangeByAnotherRange(
|
|
510
|
-
newRange,
|
|
511
|
-
selectionLayer
|
|
512
|
-
);
|
|
513
|
-
|
|
514
|
-
const { newRange: range1 } = expandOrContractRangeToPosition(
|
|
515
|
-
selectionLayer,
|
|
516
|
-
newRange.start,
|
|
517
|
-
sequenceLength
|
|
518
|
-
);
|
|
519
|
-
const { newRange: range2 } = expandOrContractRangeToPosition(
|
|
520
|
-
selectionLayer,
|
|
521
|
-
newRange.end + 1,
|
|
522
|
-
sequenceLength
|
|
523
|
-
); //+1 to go from range end to position
|
|
524
|
-
const range1Shorter =
|
|
525
|
-
getRangeLength(range1, sequenceLength) <
|
|
526
|
-
getRangeLength(range2, sequenceLength);
|
|
527
|
-
|
|
528
|
-
if (newRangeFullyContained) {
|
|
529
|
-
range1Shorter
|
|
530
|
-
? selectionLayerUpdate(range1)
|
|
531
|
-
: selectionLayerUpdate(range2);
|
|
532
|
-
} else {
|
|
533
|
-
selectionLayerUpdate({
|
|
534
|
-
forward: newRange.forward,
|
|
535
|
-
start: selectionLayer.start,
|
|
536
|
-
end: newRange.end
|
|
537
|
-
});
|
|
538
|
-
}
|
|
539
|
-
}
|
|
540
|
-
} else {
|
|
541
|
-
//no caret, no selection, so just do a simple update
|
|
542
|
-
simpleUpdate();
|
|
543
|
-
}
|
|
544
|
-
} else {
|
|
545
|
-
//no shift held, so just update the selection or caret
|
|
546
|
-
simpleUpdate();
|
|
547
|
-
}
|
|
548
|
-
function simpleUpdate() {
|
|
549
|
-
//shift not held, so just make a new selection layer or move the caret
|
|
550
|
-
if (newCaret > -1) {
|
|
551
|
-
caretPositionUpdate(newCaret);
|
|
552
|
-
} else {
|
|
553
|
-
selectionLayerUpdate(newRange);
|
|
554
|
-
}
|
|
555
|
-
}
|
|
556
|
-
}
|
|
557
|
-
|
|
558
|
-
// function isRangeShorterIfFlipped(start, end, sequenceLength) {
|
|
559
|
-
// return !(
|
|
560
|
-
// getRangeLength({ start, end }, sequenceLength) <
|
|
561
|
-
// getRangeLength({ start: end, end: start }, sequenceLength)
|
|
562
|
-
// );
|
|
563
|
-
// }
|
|
564
|
-
|
|
565
|
-
function getMinRangeLength(start, end, sequenceLength, doNotWrapOrigin) {
|
|
566
|
-
const range1 = getRangeLength({ start, end }, sequenceLength);
|
|
567
|
-
const range2 = getRangeLength({ start: end, end: start }, sequenceLength);
|
|
568
|
-
if (doNotWrapOrigin) {
|
|
569
|
-
if (start < end) {
|
|
570
|
-
return range1;
|
|
571
|
-
} else {
|
|
572
|
-
return range2;
|
|
573
|
-
}
|
|
574
|
-
}
|
|
575
|
-
return range1 < range2 ? range1 : range2;
|
|
576
|
-
}
|
package/coerceInitialValue.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export default function combineReducersDontIgnoreKeys(reducers) {
|
|
2
|
-
return function (state = {}, action) {
|
|
3
|
-
const newState = Object.keys(reducers).reduce((acc, key) => {
|
|
4
|
-
acc[key] = reducers[key](state[key], action);
|
|
5
|
-
return acc;
|
|
6
|
-
}, {});
|
|
7
|
-
return {
|
|
8
|
-
...state,
|
|
9
|
-
...newState
|
|
10
|
-
};
|
|
11
|
-
};
|
|
12
|
-
}
|
package/commandUtils.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { genericCommandFactory } from "@teselagen/ui";
|
|
2
|
-
import { noop } from "lodash-es";
|
|
3
|
-
|
|
4
|
-
export function oveCommandFactory(instance, commandDefs) {
|
|
5
|
-
return genericCommandFactory({
|
|
6
|
-
getArguments(cmdId, [ctxInfo]) {
|
|
7
|
-
const args = [instance.props];
|
|
8
|
-
const { store, editorName } = instance.props;
|
|
9
|
-
if (store && editorName) {
|
|
10
|
-
args.push(store.getState().VectorEditor[editorName]);
|
|
11
|
-
}
|
|
12
|
-
args.push(ctxInfo);
|
|
13
|
-
return args;
|
|
14
|
-
},
|
|
15
|
-
handleReturn: noop,
|
|
16
|
-
commandDefs: instance.props.massageCmds
|
|
17
|
-
? instance.props.massageCmds(commandDefs)
|
|
18
|
-
: commandDefs
|
|
19
|
-
});
|
|
20
|
-
}
|
package/constants.js
DELETED
package/copyOptions.js
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
//./caretPosition.js
|
|
2
|
-
import { createReducer } from "redux-act";
|
|
3
|
-
import createAction from "./utils/createMetaAction";
|
|
4
|
-
|
|
5
|
-
// ------------------------------------
|
|
6
|
-
// Actions
|
|
7
|
-
// ------------------------------------
|
|
8
|
-
export const toggleCopyOption = createAction("TOGGLE_COPY_OPTION"); //NOTE!!:: second argument sanitizes actions so no payload is passed
|
|
9
|
-
|
|
10
|
-
export const defaultCopyOptions = {
|
|
11
|
-
features: true,
|
|
12
|
-
partialFeatures: false,
|
|
13
|
-
parts: true,
|
|
14
|
-
partialParts: false
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
// ------------------------------------
|
|
18
|
-
// Reducer
|
|
19
|
-
// ------------------------------------
|
|
20
|
-
export default createReducer(
|
|
21
|
-
{
|
|
22
|
-
[toggleCopyOption]: (state, type) => {
|
|
23
|
-
return {
|
|
24
|
-
...state,
|
|
25
|
-
...(type === "partialFeatures" && !state[type] && { features: true }),
|
|
26
|
-
...(type === "partialParts" && !state[type] && { parts: true }),
|
|
27
|
-
...(type === "features" && { partialFeatures: !state[type] }),
|
|
28
|
-
...(type === "parts" && { partialParts: !state[type] }),
|
|
29
|
-
[type]: !state[type]
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
},
|
|
33
|
-
defaultCopyOptions
|
|
34
|
-
);
|