From e04f7787e84cef475abe8f5d001daa65f1dad0cf Mon Sep 17 00:00:00 2001 From: hingq Date: Fri, 7 Jun 2024 16:25:39 +0800 Subject: [PATCH 1/2] fix the blur of the line when use canvas --- README_he .md | 26 ++++++++++++++++++++++++++ es6/README-en.md | 37 ------------------------------------- es6/README.md | 34 ---------------------------------- example/2_features_cn.html | 5 +---- package-lock.json | 28 ++++++++++++++++++++++++++++ package.json | 5 +++-- src/jsmind.graph.js | 20 ++++++++++++++++++-- src/package-lock.json | 6 ++++++ 8 files changed, 82 insertions(+), 79 deletions(-) create mode 100644 README_he .md delete mode 100644 es6/README-en.md delete mode 100644 es6/README.md create mode 100644 src/package-lock.json diff --git a/README_he .md b/README_he .md new file mode 100644 index 00000000..8b57272a --- /dev/null +++ b/README_he .md @@ -0,0 +1,26 @@ +## 更改内容 + + [jsmind.graph.js](src\jsmind.graph.js) + +```js + set_size(w, h) { + let dpr = this.getPixelRatio(); + + // 设置实际的canvas尺寸 + this.e_canvas.width = w * dpr; + this.e_canvas.height = h * dpr; + + // 设置canvas的样式尺寸为逻辑像素 + this.e_canvas.style.width = w + 'px'; + this.e_canvas.style.height = h + 'px'; + + // 更新内部尺寸记录 + this.size.w = w; + this.size.h = h; + + // 由于设置canvas尺寸会重置上下文,因此需要重新调用scale + this.canvas_ctx.scale(dpr, dpr); // 设置缩放比例 + } +``` + +> 修复高分辨率的设备下,canvas线条模糊的问题 \ No newline at end of file diff --git a/es6/README-en.md b/es6/README-en.md deleted file mode 100644 index 122a701f..00000000 --- a/es6/README-en.md +++ /dev/null @@ -1,37 +0,0 @@ -# jsMind ES6 Version - -[[中文](README.md)] | [English] - -jsMind is now written in ES6 code, the source code is in `/src`, and the dist directory is `/es6`. - - -### Compatibility - -All features in the JS version are fully compatible in the ES6 version. - -### Migration - -If you use `jsMind` via `NPM`, no migration is required, we just changed the `main` file to `es6/jsmind.js` - -If you reference `jsMind` from CDN, the only thing you need to do is change the url from `js/*.js` to `es6/*.js`. - -E.g. - -```html - - - - - -``` - -### Deprecation - -The legacy version of jsmind and plugins have been moved to `/js-legacy`. we will no longer update them, and will remove them one day in the future. It's recommended that everyone use the latest version to follow continuous feature updates and bug fixes. - -### Local build - -You probably notice that there is no `js` files or `es6` files in the directory `/es6`. Yes, we publish the dist file to `NPM` but don't store them in the repo. - -You can download the resources from CDN, or build them locally by running `npm run build` in the root dir of the project. Read [development doc](../docs/en/5.development.md) to get the detail about code building. - diff --git a/es6/README.md b/es6/README.md deleted file mode 100644 index 5f2ad8a7..00000000 --- a/es6/README.md +++ /dev/null @@ -1,34 +0,0 @@ -# jsMind ES6 Version - -[中文] | [[English](README-en.md)] - -jsMind 使用 ES6 编写,源代码位于 `/src`,构建目录为 `/es6`。 - - -### 兼容性 - -之前 JS 版本里的所有功能,在 ES6 的版本中都是兼容的。 - -### 迁移到新版 - -如果你是通过 `NPM` 引用的 `jsMind`,则无须手动迁移,我们只是在 `project.json` 里将 `main` 修改成了 `es6/jsmind.js` 。 - -如果你是通过 CDN 引用 `jsMind` 的话,你仅仅需要把 url 从 `js/*.js` 改成 `es6/*.js` 。 如: - -```html - - - - - -``` - -### 老版本下线 - -之前的版本被移动到了 `/js-legacy` 目录里,我们将不再升级它,并会在未来的某个时间里删除此版本,建议所有人使用最新版本以获得最新的功能及bug修复。 - -### 本地构建 - -你可能注意到了,在 `es6` 这个目录里没有任何 `js` 或 `es` 文件。是的,构建的文件仅会被包含在 `NPM` 里,但并不会保留在代码库中。 - -你可以从 CDN 上下载这些文件,也可以在你本地构建,只需在项目根目录里运行 `npm run build` 即可。更详细的介绍可参考[贡献代码指南](../docs/zh/5.development.md)里的相关内容。 diff --git a/example/2_features_cn.html b/example/2_features_cn.html index 5a846d10..14f93ff7 100644 --- a/example/2_features_cn.html +++ b/example/2_features_cn.html @@ -197,10 +197,7 @@ - +