fix range selection when moving from right to left
This commit is contained in:
@@ -59,8 +59,14 @@ export class PlotViewComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
positionInImage(event) : any {
|
positionInImage(event) : any {
|
||||||
const x= event.offsetX;
|
const rect = (<HTMLImageElement>document.getElementById('result-image')).getBoundingClientRect();
|
||||||
const y= event.offsetY;
|
const x= event.clientX - rect.left;
|
||||||
|
const y= event.clientY - rect.top;
|
||||||
|
|
||||||
|
|
||||||
|
//console.log("pos: " + x+"x" +y+ " rect: "+rect.x+"x"+rect.y + " client: "+ event.clientX+"x"+ event.clientY + " offset:" + event.offsetX+"x"+event.offsetY );
|
||||||
|
console.log(JSON.stringify(rect));
|
||||||
|
|
||||||
|
|
||||||
return {x: x, y: y};
|
return {x: x, y: y};
|
||||||
}
|
}
|
||||||
@@ -103,7 +109,6 @@ export class PlotViewComponent implements OnInit {
|
|||||||
|
|
||||||
if (this.in_drag_mode && event.buttons == 1){
|
if (this.in_drag_mode && event.buttons == 1){
|
||||||
const pos = this.positionInImage(event);
|
const pos = this.positionInImage(event);
|
||||||
|
|
||||||
|
|
||||||
this.drag_end_x = Math.max(Math.min(pos.x, this.imageWidth()-this.gnuplotRMargin), this.gnuplotLMargin);
|
this.drag_end_x = Math.max(Math.min(pos.x, this.imageWidth()-this.gnuplotRMargin), this.gnuplotLMargin);
|
||||||
|
|
||||||
@@ -111,10 +116,10 @@ export class PlotViewComponent implements OnInit {
|
|||||||
const width = Math.abs(this.drag_start_x - this.drag_end_x);
|
const width = Math.abs(this.drag_start_x - this.drag_end_x);
|
||||||
|
|
||||||
if (width > 10) {
|
if (width > 10) {
|
||||||
//this.zoomInSliderStyle="position: absolute; left: "+left+"px; width: "+width+"px; top:"+this.gnuplotTMargin+"px; bottom: "+this.gnuplotBMargin+"px;";
|
|
||||||
this.zoomInSliderStyleDisplay = "block";
|
this.zoomInSliderStyleDisplay = "block";
|
||||||
this.zoomInSliderStyleLeft= left+"px";
|
this.zoomInSliderStyleLeft= left+"px";
|
||||||
this.zoomInSliderStyleWidth= width+"px";
|
this.zoomInSliderStyleWidth= width+"px";
|
||||||
|
this.zoomInSliderStyleBottomMargin = "calc(100% - "+(this.imageHeight()-this.gnuplotBMargin)+"px)";
|
||||||
} else {
|
} else {
|
||||||
this.hideZoomInSlider();
|
this.hideZoomInSlider();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user