fix: header resize line not updating on scroll
Signed-off-by: Dennis Francis <dennis.francis@collabora.com> Change-Id: If10d884cb7b24289cb1e4c8e8996f526e6fe4cbe
This commit is contained in:
parent
1886c8984f
commit
8f5ac693a7
3 changed files with 27 additions and 13 deletions
|
@ -178,6 +178,8 @@ L.Control.ColumnHeader = L.Control.Header.extend({
|
|||
this._headerInfo.forEachElement(function(elemData) {
|
||||
this.drawHeaderEntry(elemData, false, isHighlighted);
|
||||
}.bind(this));
|
||||
|
||||
this.drawResizeLineIfNeeded();
|
||||
},
|
||||
|
||||
onClick: function (point, e) {
|
||||
|
|
|
@ -556,8 +556,29 @@ L.Control.Header = L.Class.extend({
|
|||
$.contextMenu('destroy', '#document-canvas');
|
||||
},
|
||||
|
||||
inResize: function () {
|
||||
return this.containerObject.draggingSomething && this._dragEntry && this._dragDistance;
|
||||
},
|
||||
|
||||
drawResizeLineIfNeeded: function () {
|
||||
if (!this.inResize())
|
||||
return;
|
||||
|
||||
this.containerObject.setPenPosition(this);
|
||||
var x = this._isColumn ? (this._dragEntry.pos + this._dragDistance[0]): this.size[0];
|
||||
var y = this._isColumn ? this.size[1]: (this._dragEntry.pos + this._dragDistance[1]);
|
||||
|
||||
this.context.lineWidth = this.dpiScale;
|
||||
this.context.strokeStyle = 'darkblue';
|
||||
this.context.beginPath();
|
||||
this.context.moveTo(x, y);
|
||||
this.context.lineTo(this._isColumn ? x: this.containerObject.right, this._isColumn ? this.containerObject.bottom: y);
|
||||
this.context.stroke();
|
||||
},
|
||||
|
||||
onMouseMove: function (point, dragDistance) {
|
||||
if (!this.containerObject.draggingSomething) { // If we are not dragging anything.
|
||||
this._dragDistance = null;
|
||||
var result = this._entryAtPoint(point); // Data related to current entry that the mouse is over now.
|
||||
|
||||
// If mouse was over another entry previously, we draw that again (without mouse-over effect).
|
||||
|
@ -587,19 +608,8 @@ L.Control.Header = L.Class.extend({
|
|||
}
|
||||
}
|
||||
else { // We are in dragging mode.
|
||||
this.containerObject.requestReDraw(); // Remove previously drawn line.
|
||||
this.containerObject.setPenPosition(this);
|
||||
if (this._dragEntry) {
|
||||
var x = this._isColumn ? (this._dragEntry.pos + dragDistance[0]): this.size[0];
|
||||
var y = this._isColumn ? this.size[1]: (this._dragEntry.pos + dragDistance[1]);
|
||||
|
||||
this.context.lineWidth = this.dpiScale;
|
||||
this.context.strokeStyle = 'darkblue';
|
||||
this.context.beginPath();
|
||||
this.context.moveTo(x, y);
|
||||
this.context.lineTo(this._isColumn ? x: this.containerObject.right, this._isColumn ? this.containerObject.bottom: y);
|
||||
this.context.stroke();
|
||||
}
|
||||
this._dragDistance = dragDistance;
|
||||
this.containerObject.requestReDraw(); // Remove previously drawn line and paint a new one.
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
@ -173,6 +173,8 @@ L.Control.RowHeader = L.Control.Header.extend({
|
|||
this._headerInfo.forEachElement(function(elemData) {
|
||||
this.drawHeaderEntry(elemData, false, isHighlighted);
|
||||
}.bind(this));
|
||||
|
||||
this.drawResizeLineIfNeeded();
|
||||
},
|
||||
|
||||
onClick: function (point, e) {
|
||||
|
|
Loading…
Reference in a new issue