Skip to content

Commit

Permalink
fix: ceil non-integer size for Surface
Browse files Browse the repository at this point in the history
  • Loading branch information
xnv committed Dec 25, 2023
1 parent dd85a84 commit 2db0043
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 12 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# CHANGELOG

## 2.8.5
* `Surface` 生成時、非整数のサイズをエラーにせず整数に切り上げるように

## 2.8.4
* ペンタブレットによるドラッグ時、意図しない操作が起きる問題を修正

Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@akashic/pdi-browser",
"version": "2.8.4",
"version": "2.8.5",
"description": "An akashic-pdi implementation for Web browsers",
"main": "index.js",
"typings": "lib/full/index.d.ts",
Expand Down
12 changes: 3 additions & 9 deletions src/Surface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,9 @@ export abstract class Surface implements pdi.Surface {
_destroyed: boolean | undefined;

constructor(width: number, height: number, drawable: any) {
this.width = width;
this.height = height;
this._drawable = drawable;
if (width % 1 !== 0 || height % 1 !== 0) {
throw new Error("Surface#constructor: width and height must be integers");
}

this.width = width;
this.height = height;
// 非整数の動作は保証していないが、環境依存でエラーになるトラブルを軽減するため切り上げ。
this.width = Math.ceil(width);
this.height = Math.ceil(height);
this._drawable = drawable;
}

Expand Down

0 comments on commit 2db0043

Please sign in to comment.