@teselagen/ove 0.3.25 → 0.3.27

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teselagen/ove",
3
- "version": "0.3.25",
3
+ "version": "0.3.27",
4
4
  "main": "./src/index.js",
5
5
  "exports": {
6
6
  ".": {
@@ -15,10 +15,10 @@
15
15
  "dependencies": {
16
16
  "@teselagen/sequence-utils": "0.3.7",
17
17
  "@teselagen/range-utils": "0.3.7",
18
- "@teselagen/ui": "0.3.25",
18
+ "@teselagen/ui": "0.3.28",
19
19
  "@teselagen/file-utils": "0.3.9",
20
20
  "@teselagen/bounce-loader": "0.3.11",
21
- "@teselagen/bio-parsers": "0.3.8",
21
+ "@teselagen/bio-parsers": "0.3.9",
22
22
  "@blueprintjs/core": "3.52.0",
23
23
  "@blueprintjs/datetime": "3.23.19",
24
24
  "@blueprintjs/icons": "3.33.0",
@@ -737,7 +737,7 @@ export class AlignmentView extends React.Component {
737
737
  scrollbarWidth: "none",
738
738
  whiteSpace: "nowrap"
739
739
  }}
740
- title={name}
740
+ data-title={name}
741
741
  key={i}
742
742
  >
743
743
  <div
@@ -1514,7 +1514,7 @@ export class AlignmentView extends React.Component {
1514
1514
  textOverflow: "ellipsis",
1515
1515
  whiteSpace: "nowrap"
1516
1516
  }}
1517
- title={
1517
+ data-title={
1518
1518
  this.props.alignmentType || "Unknown Alignment Type"
1519
1519
  }
1520
1520
  >
@@ -4,6 +4,7 @@ import withHover from "../../helperComponents/withHover";
4
4
  import "./style.css";
5
5
  import React from "react";
6
6
  import { cloneDeep, clamp, noop } from "lodash";
7
+ import { avoidOverlapWith } from "../drawAnnotations";
7
8
 
8
9
  const fontWidthToFontSize = 1.75;
9
10
 
@@ -262,7 +263,7 @@ const DrawLabelGroup = withHover(function ({
262
263
  //if label xStart or label xEnd don't fit within the canvas, we need to shorten the label..
263
264
 
264
265
  let content;
265
- const labelClass = ` veLabelText veCircularViewLabelText clickable ${label.color} `;
266
+ const labelClass = ` veLabelText veLabel veCircularViewLabelText clickable ${label.color} `;
266
267
 
267
268
  if ((multipleLabels || groupLabelXStart !== undefined) && hovered) {
268
269
  //HOVERED: DRAW MULTIPLE LABELS IN A RECTANGLE
@@ -310,7 +311,7 @@ const DrawLabelGroup = withHover(function ({
310
311
  line,
311
312
 
312
313
  <PutMyParentOnTop editorName={editorName} key="gGroup">
313
- <g className={className + " topLevelLabelGroup"}>
314
+ <g className={className + " veLabel topLevelLabelGroup"}>
314
315
  <rect
315
316
  onMouseOver={cancelFn}
316
317
  // zIndex={10}
@@ -355,9 +356,11 @@ const DrawLabelGroup = withHover(function ({
355
356
  } else {
356
357
  //DRAW A SINGLE LABEL
357
358
  content = [
358
- <title key="labeltitle">{label.title || label.text}</title>,
359
+ // <title key="labeltitle">{label.title || label.text}</title>,
359
360
  <text
360
361
  key="text"
362
+ data-title={label.title || label.text}
363
+ {...avoidOverlapWith}
361
364
  x={labelXStart}
362
365
  textLength={getTextLength(text) * fontWidth}
363
366
  lengthAdjust="spacing"
@@ -444,6 +447,8 @@ const DrawGroupInnerLabel = withHover(
444
447
  ({ className, labelXStart, label, fontWidth, onMouseOver, index, dy }) => {
445
448
  return (
446
449
  <tspan
450
+ data-title={label.title}
451
+ {...avoidOverlapWith}
447
452
  x={labelXStart}
448
453
  textLength={getTextLength(label.text) * fontWidth}
449
454
  lengthAdjust="spacing"
@@ -461,7 +466,7 @@ const DrawGroupInnerLabel = withHover(
461
466
  {...{ onMouseOver }}
462
467
  className={className}
463
468
  >
464
- <title>{label.title}</title>
469
+ {/* <title>{label.title}</title> */}
465
470
  {label.text}
466
471
  </tspan>
467
472
  );
@@ -360,7 +360,6 @@ function DrawAnnotationInner({
360
360
  onMouseLeave,
361
361
  onMouseOver
362
362
  };
363
- const title = <title>{titleText}</title>;
364
363
  function getInner(
365
364
  {
366
365
  startAngle,
@@ -381,17 +380,15 @@ function DrawAnnotationInner({
381
380
  return (
382
381
  <g
383
382
  transform={transform}
383
+ data-title={noTitle ? null : titleText}
384
+ {...avoidOverlapWith}
384
385
  key={
385
386
  isNotLocation
386
387
  ? "notLocation"
387
388
  : "location--" + annotation.id + "--" + i
388
389
  }
389
- // {...(ellipsizedName && ellipsizedName !== name
390
- // ? { "data-tip": name }
391
- // : {})}
392
390
  {...sharedProps}
393
391
  >
394
- {noTitle ? null : title}
395
392
  <Annotation
396
393
  {...(passAnnotation && { annotation })}
397
394
  annotationType={annotationType}
@@ -431,3 +428,8 @@ function DrawAnnotationInner({
431
428
  }
432
429
 
433
430
  const DrawAnnotation = withHover(DrawAnnotationInner);
431
+
432
+ export const avoidOverlapWith = {
433
+ "data-avoid": ".topLevelLabelGroup",
434
+ "data-avoid-backup": ".veLabel.veAnnotationHovered"
435
+ };
@@ -64,20 +64,44 @@ export default compose(
64
64
  }, hoveredAnnotationActions)
65
65
  ),
66
66
  withHandlers({
67
- onMouseOver: props => e => {
68
- const { editorName, id, hoveredAnnotationUpdate } = props;
69
- const isIdHashmap = typeof id === "object";
70
- const idToPass = isIdHashmap ? Object.keys(id)[0] : id;
71
- const annot = props?.annotation || props?.label?.annotation;
72
- if (modifiableTypes.includes(annot?.annotationTypePlural)) {
73
- hoveredAnnEasyStore.hoveredAnn = annot;
74
- }
75
- //because the calling onHover can slow things down, we disable it if dragging or scrolling
76
- if (window.__veDragging || window.__veScrolling) return;
77
- e.stopPropagation(); //this is important otherwise hovering labels inside circular view label groups won't work
78
- hoveredAnnotationUpdate &&
79
- hoveredAnnotationUpdate(idToPass, { editorName });
80
- },
67
+ onMouseOver: props =>
68
+ function (e) {
69
+ // loop through the target element and the parents and see if any of them have the hoverHelper class
70
+ // if they do, then we don't want to trigger the hover event
71
+ // if they don't, then we do want to trigger the hover event
72
+ // we should stop the loop if the target element is implementing this onMouseOver event
73
+ // e.stopPropagation(); //this is important otherwise hovering labels inside circular view label groups won't work
74
+ const target = e.target;
75
+ let alreadyHandled = false;
76
+ let currentElement = target;
77
+ while (currentElement) {
78
+ if (currentElement === e.currentTarget) {
79
+ break;
80
+ }
81
+ // console.log(`currentElement:`, currentElement)
82
+
83
+ if (currentElement.classList.contains("hoverHelper")) {
84
+ alreadyHandled = true;
85
+ break;
86
+ }
87
+ currentElement = currentElement.parentElement;
88
+ }
89
+ if (alreadyHandled) return;
90
+
91
+ // const alreadyHandled = e.target.classList.contains("hoverHelper");
92
+ const { editorName, id, hoveredAnnotationUpdate } = props;
93
+ const isIdHashmap = typeof id === "object";
94
+ const idToPass = isIdHashmap ? Object.keys(id)[0] : id;
95
+ const annot = props?.annotation || props?.label?.annotation;
96
+ if (modifiableTypes.includes(annot?.annotationTypePlural)) {
97
+ hoveredAnnEasyStore.hoveredAnn = annot;
98
+ }
99
+ //because the calling onHover can slow things down, we disable it if dragging or scrolling
100
+ if (window.__veDragging || window.__veScrolling) return;
101
+
102
+ hoveredAnnotationUpdate &&
103
+ hoveredAnnotationUpdate(idToPass, { editorName });
104
+ },
81
105
  onMouseLeave: props => e => {
82
106
  hoveredAnnEasyStore.hoveredAnn = undefined;
83
107
  const { editorName, hoveredAnnotationClear } = props;
package/style.css CHANGED
@@ -9029,6 +9029,18 @@ code {
9029
9029
  display: none;
9030
9030
  }
9031
9031
 
9032
+ .isDataTitle .tippy-arrow {
9033
+ opacity: 0 !important;
9034
+ }
9035
+ .isDataTitle .tippy-box {
9036
+ background-color: #4f4a50f4 !important;
9037
+ border-radius: 0 !important;
9038
+ color: #f3f3f3 !important;
9039
+ font-size: 11px !important;
9040
+ white-space: pre-wrap;
9041
+ padding: 0px 0px !important;
9042
+ }
9043
+
9032
9044
  [data-tippy-root] {
9033
9045
  z-index: 100000 !important;
9034
9046
  }