Merge pull request #1002 from Tyriar/990_fix_link_issues
Fix link clearing issues
This commit is contained in:
@@ -49,10 +49,16 @@ export class MouseZoneManager implements IMouseZoneManager {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Clear all if start/end weren't set
|
||||||
|
if (!end) {
|
||||||
|
start = 0;
|
||||||
|
end = this._terminal.rows - 1;
|
||||||
|
}
|
||||||
|
|
||||||
// Iterate through zones and clear them out if they're within the range
|
// Iterate through zones and clear them out if they're within the range
|
||||||
for (let i = 0; i < this._zones.length; i++) {
|
for (let i = 0; i < this._zones.length; i++) {
|
||||||
const zone = this._zones[i];
|
const zone = this._zones[i];
|
||||||
if (zone.y >= start && zone.y <= end) {
|
if (zone.y > start && zone.y <= end + 1) {
|
||||||
if (this._currentZone && this._currentZone === zone) {
|
if (this._currentZone && this._currentZone === zone) {
|
||||||
this._currentZone.leaveCallback();
|
this._currentZone.leaveCallback();
|
||||||
this._currentZone = null;
|
this._currentZone = null;
|
||||||
|
|||||||
@@ -91,16 +91,6 @@ export abstract class BaseRenderLayer implements IRenderLayer {
|
|||||||
|
|
||||||
public abstract reset(terminal: ITerminal): void;
|
public abstract reset(terminal: ITerminal): void;
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the left position of a cell. Since character width is stored as a
|
|
||||||
* float in order to prevent bad letter spacing, drawing shapes in the cell
|
|
||||||
* need to be rounded.
|
|
||||||
* @param x The column of the cell.
|
|
||||||
*/
|
|
||||||
private _getCellLeft(x: number): number {
|
|
||||||
return Math.round(x * this._scaledCharWidth);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fills 1+ cells completely. This uses the existing fillStyle on the context.
|
* Fills 1+ cells completely. This uses the existing fillStyle on the context.
|
||||||
* @param x The column to start at.
|
* @param x The column to start at.
|
||||||
@@ -109,12 +99,11 @@ export abstract class BaseRenderLayer implements IRenderLayer {
|
|||||||
* @param height The number of rows to fill.
|
* @param height The number of rows to fill.
|
||||||
*/
|
*/
|
||||||
protected fillCells(x: number, y: number, width: number, height: number): void {
|
protected fillCells(x: number, y: number, width: number, height: number): void {
|
||||||
const cellLeft = this._getCellLeft(x);
|
|
||||||
this._ctx.fillRect(
|
this._ctx.fillRect(
|
||||||
cellLeft,
|
x * this._scaledCharWidth,
|
||||||
y * this._scaledLineHeight,
|
y * this._scaledLineHeight,
|
||||||
this._getCellLeft(x + width) - cellLeft,
|
width * this._scaledCharWidth,
|
||||||
height * this._scaledLineHeight);
|
height * this._scaledLineHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -124,11 +113,10 @@ export abstract class BaseRenderLayer implements IRenderLayer {
|
|||||||
* @param y The row to fill.
|
* @param y The row to fill.
|
||||||
*/
|
*/
|
||||||
protected fillBottomLineAtCells(x: number, y: number, width: number = 1): void {
|
protected fillBottomLineAtCells(x: number, y: number, width: number = 1): void {
|
||||||
const cellLeft = this._getCellLeft(x);
|
|
||||||
this._ctx.fillRect(
|
this._ctx.fillRect(
|
||||||
cellLeft,
|
x * this._scaledCharWidth,
|
||||||
(y + 1) * this._scaledLineHeight - window.devicePixelRatio - 1 /* Ensure it's drawn within the cell */,
|
(y + 1) * this._scaledLineHeight - window.devicePixelRatio - 1 /* Ensure it's drawn within the cell */,
|
||||||
this._getCellLeft(x + width) - cellLeft,
|
width * this._scaledCharWidth,
|
||||||
window.devicePixelRatio);
|
window.devicePixelRatio);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -140,7 +128,7 @@ export abstract class BaseRenderLayer implements IRenderLayer {
|
|||||||
*/
|
*/
|
||||||
protected fillLeftLineAtCell(x: number, y: number): void {
|
protected fillLeftLineAtCell(x: number, y: number): void {
|
||||||
this._ctx.fillRect(
|
this._ctx.fillRect(
|
||||||
this._getCellLeft(x),
|
x * this._scaledCharWidth,
|
||||||
y * this._scaledLineHeight,
|
y * this._scaledLineHeight,
|
||||||
window.devicePixelRatio,
|
window.devicePixelRatio,
|
||||||
this._scaledLineHeight);
|
this._scaledLineHeight);
|
||||||
@@ -153,12 +141,11 @@ export abstract class BaseRenderLayer implements IRenderLayer {
|
|||||||
* @param y The row to fill.
|
* @param y The row to fill.
|
||||||
*/
|
*/
|
||||||
protected strokeRectAtCell(x: number, y: number, width: number, height: number): void {
|
protected strokeRectAtCell(x: number, y: number, width: number, height: number): void {
|
||||||
const cellLeft = this._getCellLeft(x);
|
|
||||||
this._ctx.lineWidth = window.devicePixelRatio;
|
this._ctx.lineWidth = window.devicePixelRatio;
|
||||||
this._ctx.strokeRect(
|
this._ctx.strokeRect(
|
||||||
cellLeft + window.devicePixelRatio / 2,
|
x * this._scaledCharWidth + window.devicePixelRatio / 2,
|
||||||
y * this._scaledLineHeight + (window.devicePixelRatio / 2),
|
y * this._scaledLineHeight + (window.devicePixelRatio / 2),
|
||||||
this._getCellLeft(x + width) - cellLeft - window.devicePixelRatio,
|
width * this._scaledCharWidth - window.devicePixelRatio,
|
||||||
(height * this._scaledLineHeight) - window.devicePixelRatio);
|
(height * this._scaledLineHeight) - window.devicePixelRatio);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -182,19 +169,18 @@ export abstract class BaseRenderLayer implements IRenderLayer {
|
|||||||
* @param height The number of rows to clear.
|
* @param height The number of rows to clear.
|
||||||
*/
|
*/
|
||||||
protected clearCells(x: number, y: number, width: number, height: number): void {
|
protected clearCells(x: number, y: number, width: number, height: number): void {
|
||||||
const cellLeft = this._getCellLeft(x);
|
|
||||||
if (this._alpha) {
|
if (this._alpha) {
|
||||||
this._ctx.clearRect(
|
this._ctx.clearRect(
|
||||||
cellLeft,
|
x * this._scaledCharWidth,
|
||||||
y * this._scaledLineHeight,
|
y * this._scaledLineHeight,
|
||||||
this._getCellLeft(x + width) - cellLeft,
|
width * this._scaledCharWidth,
|
||||||
height * this._scaledLineHeight);
|
height * this._scaledLineHeight);
|
||||||
} else {
|
} else {
|
||||||
this._ctx.fillStyle = this._colors.background;
|
this._ctx.fillStyle = this._colors.background;
|
||||||
this._ctx.fillRect(
|
this._ctx.fillRect(
|
||||||
cellLeft,
|
x * this._scaledCharWidth,
|
||||||
y * this._scaledLineHeight,
|
y * this._scaledLineHeight,
|
||||||
this._getCellLeft(x + width) - cellLeft,
|
width * this._scaledCharWidth,
|
||||||
height * this._scaledLineHeight);
|
height * this._scaledLineHeight);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user