Browse Source

Fixes for deleted segments

master
rozetko 6 years ago
parent
commit
18e64911de
  1. 15
      src/panel/graph_panel/controllers/analytic_controller.ts
  2. 5
      src/panel/graph_panel/graph_renderer.ts
  3. 4
      src/panel/graph_panel/graph_tooltip.ts
  4. 2
      src/panel/graph_panel/models/analytic_unit.ts

15
src/panel/graph_panel/controllers/analytic_controller.ts

@ -26,7 +26,7 @@ export const REGION_STROKE_ALPHA = 0.9;
export const REGION_DELETE_COLOR_LIGHT = '#d1d1d1'; export const REGION_DELETE_COLOR_LIGHT = '#d1d1d1';
export const REGION_DELETE_COLOR_DARK = 'white'; export const REGION_DELETE_COLOR_DARK = 'white';
const LABELED_SEGMENT_BORDER_COLOR = 'black'; const LABELED_SEGMENT_BORDER_COLOR = 'black';
const DELETED_SEGMENT_FILL_COLOR = 'black'; const DELETED_SEGMENT_FILL_COLOR = '#00f0ff';
const DELETED_SEGMENT_BORDER_COLOR = 'black'; const DELETED_SEGMENT_BORDER_COLOR = 'black';
@ -185,7 +185,7 @@ export class AnalyticController {
return this.labelingUnit.deleteMode; return this.labelingUnit.deleteMode;
} }
addLabelSegment(segment: Segment, deleted?: boolean) { addLabelSegment(segment: Segment, deleted = false) {
var asegment = this.labelingUnit.addLabeledSegment(segment, deleted); var asegment = this.labelingUnit.addLabeledSegment(segment, deleted);
this._labelingDataAddedSegments.addSegment(asegment); this._labelingDataAddedSegments.addSegment(asegment);
} }
@ -288,22 +288,16 @@ export class AnalyticController {
let segmentBorderColor; let segmentBorderColor;
let segmentFillColor = fillColor; let segmentFillColor = fillColor;
if(this.labelingDeleteMode) {
if(s.deleted) { if(s.deleted) {
segmentBorderColor = deletedSegmentBorderColor; segmentBorderColor = deletedSegmentBorderColor;
segmentFillColor = deletedSegmentFillColor; segmentFillColor = deletedSegmentFillColor;
}
} else { } else {
if(s.deleted) {
return;
}
}
if(s.labeled) { if(s.labeled) {
segmentBorderColor = labeledSegmentBorderColor; segmentBorderColor = labeledSegmentBorderColor;
} else { } else {
segmentBorderColor = borderColor; segmentBorderColor = borderColor;
} }
}
var expanded = s.expandDist(rangeDist, 0.01); var expanded = s.expandDist(rangeDist, 0.01);
options.grid.markings.push({ options.grid.markings.push({
@ -324,10 +318,11 @@ export class AnalyticController {
} }
deleteLabelingAnalyticUnitSegmentsInRange(from: number, to: number) { deleteLabelingAnalyticUnitSegmentsInRange(from: number, to: number) {
var allRemovedSegs = this.labelingUnit.removeSegmentsInRange(from, to); let allRemovedSegs = this.labelingUnit.removeSegmentsInRange(from, to);
allRemovedSegs.forEach(s => { allRemovedSegs.forEach(s => {
if(!this._labelingDataAddedSegments.has(s.id)) { if(!this._labelingDataAddedSegments.has(s.id)) {
this._labelingDataDeletedSegments.addSegment(s); this._labelingDataDeletedSegments.addSegment(s);
this.labelingUnit.addLabeledSegment(s, true);
} }
}); });
this._labelingDataAddedSegments.removeInRange(from, to); this._labelingDataAddedSegments.removeInRange(from, to);

5
src/panel/graph_panel/graph_renderer.ts

@ -150,10 +150,9 @@ export class GraphRenderer {
this._analyticController.deleteLabelingAnalyticUnitSegmentsInRange( this._analyticController.deleteLabelingAnalyticUnitSegmentsInRange(
segment.from, segment.to segment.from, segment.to
); );
} else {
this._analyticController.addLabelSegment(segment);
} }
this._analyticController.addLabelSegment(
segment, this._analyticController.labelingDeleteMode
);
this.renderPanel(); this.renderPanel();
return; return;

4
src/panel/graph_panel/graph_tooltip.ts

@ -200,10 +200,6 @@ export class GraphTooltip {
var from = this.dashboard.formatDate(s.segment.from, 'HH:mm:ss.SSS'); var from = this.dashboard.formatDate(s.segment.from, 'HH:mm:ss.SSS');
var to = this.dashboard.formatDate(s.segment.to, 'HH:mm:ss.SSS'); var to = this.dashboard.formatDate(s.segment.to, 'HH:mm:ss.SSS');
if(s.segment.deleted && !s.analyticUnit.deleteMode) {
return;
}
let icon; let icon;
if(s.segment.labeled) { if(s.segment.labeled) {
icon = 'fa-thumb-tack'; icon = 'fa-thumb-tack';

2
src/panel/graph_panel/models/analytic_unit.ts

@ -81,7 +81,7 @@ export class AnalyticUnit {
} }
addLabeledSegment(segment: Segment, deleted: boolean): AnalyticSegment { addLabeledSegment(segment: Segment, deleted: boolean): AnalyticSegment {
var asegment = new AnalyticSegment(true, segment.id, segment.from, segment.to, deleted); var asegment = new AnalyticSegment(!deleted, segment.id, segment.from, segment.to, deleted);
this._segmentSet.addSegment(asegment); this._segmentSet.addSegment(asegment);
return asegment; return asegment;
} }

Loading…
Cancel
Save