And even further

pull/2829/head
Luke Morris 2018-02-21 18:14:41 -08:00
parent e10bd65606
commit 807beb8a9d
4 changed files with 40 additions and 15 deletions

View File

@ -55,7 +55,7 @@ class AnnotationInput extends Component {
const {value} = this.props const {value} = this.props
return ( return (
<div className="annotation-tooltip--input"> <div className="annotation-tooltip--input-container">
{isEditing {isEditing
? <form ? <form
onSubmit={this.handleFormSubmit} onSubmit={this.handleFormSubmit}

View File

@ -94,6 +94,7 @@ class AnnotationSpan extends React.Component {
const isEditing = this.props.mode === EDITING const isEditing = this.props.mode === EDITING
const humanTime = `${new Date(+startTime)}` const humanTime = `${new Date(+startTime)}`
const {isDragging} = this.state const {isDragging} = this.state
const {annotation} = this.props
const flagClass = isDragging const flagClass = isDragging
? 'annotation-span--left-flag dragging' ? 'annotation-span--left-flag dragging'
@ -112,6 +113,12 @@ class AnnotationSpan extends React.Component {
data-time-ms={startTime} data-time-ms={startTime}
data-time-local={humanTime} data-time-local={humanTime}
> >
<AnnotationTooltip
isEditing={isEditing}
annotation={annotation}
onMouseLeave={this.handleMouseLeave}
annotationState={this.state}
/>
<div <div
className={clickClass} className={clickClass}
draggable={true} draggable={true}
@ -130,6 +137,7 @@ class AnnotationSpan extends React.Component {
const isEditing = this.props.mode === EDITING const isEditing = this.props.mode === EDITING
const humanTime = `${new Date(+endTime)}` const humanTime = `${new Date(+endTime)}`
const {isDragging} = this.state const {isDragging} = this.state
const {annotation} = this.props
const flagClass = isDragging const flagClass = isDragging
? 'annotation-span--right-flag dragging' ? 'annotation-span--right-flag dragging'
@ -147,6 +155,12 @@ class AnnotationSpan extends React.Component {
data-time-ms={endTime} data-time-ms={endTime}
data-time-local={humanTime} data-time-local={humanTime}
> >
<AnnotationTooltip
isEditing={isEditing}
annotation={annotation}
onMouseLeave={this.handleMouseLeave}
annotationState={this.state}
/>
<div <div
className={clickClass} className={clickClass}
draggable={true} draggable={true}
@ -163,17 +177,10 @@ class AnnotationSpan extends React.Component {
render() { render() {
const {annotation, dygraph} = this.props const {annotation, dygraph} = this.props
const isEditing = this.props.mode === EDITING
return ( return (
<div> <div>
<AnnotationWindow annotation={annotation} dygraph={dygraph} /> <AnnotationWindow annotation={annotation} dygraph={dygraph} />
<AnnotationTooltip
isEditing={isEditing}
annotation={annotation}
onMouseLeave={this.handleMouseLeave}
annotationState={this.state}
/>
{this.renderLeftMarker(annotation.startTime, dygraph)} {this.renderLeftMarker(annotation.startTime, dygraph)}
{this.renderRightMarker(annotation.endTime, dygraph)} {this.renderRightMarker(annotation.endTime, dygraph)}
</div> </div>

View File

@ -7,7 +7,7 @@ import * as schema from 'shared/schemas'
import * as actions from 'shared/actions/annotations' import * as actions from 'shared/actions/annotations'
const TimeStamp = ({time}) => const TimeStamp = ({time}) =>
<div className="annotation-tooltip--timestmap"> <div className="annotation-tooltip--timestamp">
{`${moment(+time).format('YYYY/DD/MM HH:mm:ss.SS')}`} {`${moment(+time).format('YYYY/DD/MM HH:mm:ss.SS')}`}
</div> </div>

View File

@ -11,6 +11,7 @@ $timestamp-font-weight: 600;
.annotation-point--flag { .annotation-point--flag {
position: absolute; position: absolute;
z-index: 2;
top: -3px; top: -3px;
left: -2px; left: -2px;
width: 6px; width: 6px;
@ -28,6 +29,7 @@ $timestamp-font-weight: 600;
.annotation-span--flag { .annotation-span--flag {
position: absolute; position: absolute;
z-index: 2;
top: -6px; top: -6px;
width: 0; width: 0;
height: 0; height: 0;
@ -50,6 +52,10 @@ $timestamp-font-weight: 600;
&.dragging { &.dragging {
border-left-color: $annotation-color__drag; border-left-color: $annotation-color__drag;
} }
&:hover {
border-left-color: red;
}
} }
.annotation-span--right-flag { .annotation-span--right-flag {
@ -64,22 +70,20 @@ $timestamp-font-weight: 600;
} }
// width: 100%;
.annotation-tooltip { .annotation-tooltip {
position: absolute; position: absolute;
width: 100%;
bottom: calc(100% + 6px); bottom: calc(100% + 6px);
left: 50%; left: 50%;
transform: translateX(-50%); transform: translateX(-50%);
background-color: $g0-obsidian; background-color: $g0-obsidian;
z-index: 3;
padding: 6px 12px; padding: 6px 12px;
border-radius: 4px; border-radius: 4px;
white-space: nowrap; white-space: nowrap;
user-select: none; user-select: none;
display: flex; display: flex;
flex: 1 0 0;
box-shadow: 0 0 10px 2px $g2-kevlar; box-shadow: 0 0 10px 2px $g2-kevlar;
margin-bottom: 4px;
&:before { &:before {
content: ''; content: '';
@ -89,6 +93,7 @@ $timestamp-font-weight: 600;
height: calc(100% + 28px); height: calc(100% + 28px);
top: -14px; top: -14px;
left: -8px; left: -8px;
z-index: -1;
} }
&.hidden { &.hidden {
@ -126,6 +131,14 @@ $timestamp-font-weight: 600;
} }
} }
.annotation-tooltip--input {
flex: 1 0 0;
}
.annotation-tooltip--input-container {
width: 100%;
margin-bottom: 4px;
}
.annotation-tooltip--input .input-cte { .annotation-tooltip--input .input-cte {
height: 22px; height: 22px;
font-size: 12px; font-size: 12px;
@ -162,7 +175,7 @@ $timestamp-font-weight: 600;
.annotation { .annotation {
position: absolute; position: absolute;
top: 8px; top: 8px;
z-index: 5; z-index: 3;
background-color: $annotation-color; background-color: $annotation-color;
height: calc(100% - 36px); height: calc(100% - 36px);
width: 2px; width: 2px;
@ -172,6 +185,7 @@ $timestamp-font-weight: 600;
&.dragging { &.dragging {
background-color: $annotation-color__drag; background-color: $annotation-color__drag;
z-index: 4;
} }
} }
@ -181,6 +195,7 @@ $timestamp-font-weight: 600;
left: -7px; left: -7px;
width: 16px; width: 16px;
height: 16px; height: 16px;
z-index: 4;
cursor: default; cursor: default;
&.editing { &.editing {
@ -197,6 +212,7 @@ $timestamp-font-weight: 600;
background: linear-gradient(to bottom, $window15 0%, $window0 100%); background: linear-gradient(to bottom, $window15 0%, $window0 100%);
height: calc(100% - 36px); height: calc(100% - 36px);
border-top: 2px dotted $window35; border-top: 2px dotted $window35;
z-index: 1;
} }
@ -227,6 +243,7 @@ $timestamp-font-weight: 600;
transform: translateX(-1px); transform: translateX(-1px);
background: linear-gradient(to bottom, $c-hydrogen 0%, $c-pool 100%); background: linear-gradient(to bottom, $c-hydrogen 0%, $c-pool 100%);
transition: opacity 0.4s ease; transition: opacity 0.4s ease;
z-index: 5;
cursor: pointer; cursor: pointer;
} }
@ -241,6 +258,7 @@ $timestamp-font-weight: 600;
bottom: calc(100% + 8px); bottom: calc(100% + 8px);
left: 50%; left: 50%;
transform: translateX(-50%); transform: translateX(-50%);
z-index: 10;
} }
.new-annotation.hover .new-annotation-tooltip { .new-annotation.hover .new-annotation-tooltip {
display: flex; display: flex;