Fix block elements on webgl, scale block elements to cell
This commit is contained in:
@@ -394,7 +394,7 @@ export class WebglCharAtlas implements IDisposable {
|
|||||||
// Draw custom characters if applicable
|
// Draw custom characters if applicable
|
||||||
let drawSuccess = false;
|
let drawSuccess = false;
|
||||||
if (this._config.customBlockAndBoxCharacters !== false) {
|
if (this._config.customBlockAndBoxCharacters !== false) {
|
||||||
drawSuccess = tryDrawCustomChar(this._tmpCtx, chars, TMP_CANVAS_GLYPH_PADDING, TMP_CANVAS_GLYPH_PADDING, this._config.scaledCellWidth, this._config.scaledCellHeight, this._config.scaledCharWidth, this._config.scaledCharHeight);
|
drawSuccess = tryDrawCustomChar(this._tmpCtx, chars, TMP_CANVAS_GLYPH_PADDING, TMP_CANVAS_GLYPH_PADDING, this._config.scaledCellWidth, this._config.scaledCellHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw the character
|
// Draw the character
|
||||||
|
|||||||
@@ -264,7 +264,7 @@ export abstract class BaseRenderLayer implements IRenderLayer {
|
|||||||
// Draw custom characters if applicable
|
// Draw custom characters if applicable
|
||||||
let drawSuccess = false;
|
let drawSuccess = false;
|
||||||
if (this._optionsService.options.customBlockAndBoxCharacters !== false) {
|
if (this._optionsService.options.customBlockAndBoxCharacters !== false) {
|
||||||
drawSuccess = tryDrawCustomChar(this._ctx, cell.getChars(), x * this._scaledCellWidth, y * this._scaledCellHeight, this._scaledCellWidth, this._scaledCellHeight, this._scaledCharLeft, this._scaledCharTop);
|
drawSuccess = tryDrawCustomChar(this._ctx, cell.getChars(), x * this._scaledCellWidth, y * this._scaledCellHeight, this._scaledCellWidth, this._scaledCellHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw the character
|
// Draw the character
|
||||||
@@ -388,7 +388,7 @@ export abstract class BaseRenderLayer implements IRenderLayer {
|
|||||||
// Draw custom characters if applicable
|
// Draw custom characters if applicable
|
||||||
let drawSuccess = false;
|
let drawSuccess = false;
|
||||||
if (this._optionsService.options.customBlockAndBoxCharacters !== false) {
|
if (this._optionsService.options.customBlockAndBoxCharacters !== false) {
|
||||||
drawSuccess = tryDrawCustomChar(this._ctx, cell.getChars(), x * this._scaledCellWidth, y * this._scaledCellHeight, this._scaledCellWidth, this._scaledCellHeight, this._scaledCharLeft, this._scaledCharTop);
|
drawSuccess = tryDrawCustomChar(this._ctx, cell.getChars(), x * this._scaledCellWidth, y * this._scaledCellHeight, this._scaledCellWidth, this._scaledCellHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw the character
|
// Draw the character
|
||||||
|
|||||||
@@ -291,13 +291,11 @@ export function tryDrawCustomChar(
|
|||||||
xOffset: number,
|
xOffset: number,
|
||||||
yOffset: number,
|
yOffset: number,
|
||||||
scaledCellWidth: number,
|
scaledCellWidth: number,
|
||||||
scaledCellHeight: number,
|
scaledCellHeight: number
|
||||||
scaledCharLeft: number,
|
|
||||||
scaledCharTop: number
|
|
||||||
): boolean {
|
): boolean {
|
||||||
const blockElementDefinition = blockElementDefinitions[c];
|
const blockElementDefinition = blockElementDefinitions[c];
|
||||||
if (blockElementDefinition) {
|
if (blockElementDefinition) {
|
||||||
drawBlockElementChar(ctx, blockElementDefinition, xOffset, yOffset, scaledCellWidth, scaledCellHeight, scaledCharLeft, scaledCharTop);
|
drawBlockElementChar(ctx, blockElementDefinition, xOffset, yOffset, scaledCellWidth, scaledCellHeight);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -316,13 +314,8 @@ function drawBlockElementChar(
|
|||||||
xOffset: number,
|
xOffset: number,
|
||||||
yOffset: number,
|
yOffset: number,
|
||||||
scaledCellWidth: number,
|
scaledCellWidth: number,
|
||||||
scaledCellHeight: number,
|
scaledCellHeight: number
|
||||||
scaledCharLeft: number,
|
|
||||||
scaledCharTop: number
|
|
||||||
): void {
|
): void {
|
||||||
// TODO: Scale to cell not char?
|
|
||||||
xOffset += scaledCharLeft;
|
|
||||||
yOffset += scaledCharTop;
|
|
||||||
for (let i = 0; i < charDefinition.length; i++) {
|
for (let i = 0; i < charDefinition.length; i++) {
|
||||||
const box = charDefinition[i];
|
const box = charDefinition[i];
|
||||||
const xEighth = scaledCellWidth / 8;
|
const xEighth = scaledCellWidth / 8;
|
||||||
|
|||||||
Reference in New Issue
Block a user