feat: @idraw/board add getScrollLineWidth method

This commit is contained in:
chenshenhai 2021-06-18 18:10:42 +08:00
parent 2ed2fbc354
commit 6c428a77a4
3 changed files with 11 additions and 2 deletions

View file

@ -86,6 +86,8 @@
console.log('result =', result);
board.draw();
console.log('scrollLineWidth = ', board.getScrollLineWidth())
</script>
</body>

View file

@ -155,6 +155,10 @@ class Board {
this.draw();
}
getScrollLineWidth(): number {
return this[_scroller].getLineWidth();
}
private [_render]() {
if (this[_hasRendered] === true) {
return;

View file

@ -19,13 +19,11 @@ type TypePrivateOptions = TypeOptions & {
scrollConfig: TypeBoardScrollConfig,
}
const defaultScrollConfig = {
lineWidth: 12,
color: '#a0a0a0'
}
export class Scroller {
private _displayCtx: CanvasRenderingContext2D;
@ -124,6 +122,11 @@ export class Scroller {
return false;
}
getLineWidth(): number {
const lineWidth = this._opts.scrollConfig.lineWidth;
return lineWidth;
}
calc(position: TypeScreenPosition) {
const { width, height, scrollConfig } = this._opts;