mirror of
https://github.com/idrawjs/idraw
synced 2026-05-23 09:38:22 +00:00
fix: idraw options transfer to core
This commit is contained in:
parent
c9a5c7f76c
commit
cd9073cdb5
8 changed files with 14 additions and 6 deletions
|
|
@ -24,5 +24,5 @@ module.exports = {
|
|||
"@typescript-eslint/rule-name": "off",
|
||||
"@typescript-eslint/no-explicit-any": "off",
|
||||
"@typescript-eslint/explicit-module-boundary-types": "off"
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
|
|||
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -110,6 +110,7 @@ temp/
|
|||
/temp/
|
||||
|
||||
__tests__/diff
|
||||
__tests__/test-result
|
||||
# __tests__/snapshot
|
||||
|
||||
reports/
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ const { createScreenshot } = require('../scripts/util/screen');
|
|||
|
||||
const snapshotDir = path.join(__dirname, 'snapshot');
|
||||
const diffDir = path.join(__dirname, 'diff');
|
||||
const testResultDir = path.join(__dirname, 'test-result');
|
||||
const { PNG } = pngjs;
|
||||
|
||||
async function diff() {
|
||||
|
|
@ -34,6 +35,7 @@ async function diff() {
|
|||
const failedPixel = pixelmatch(expected.data, actual.data, diffBuf.data, actual.width, actual.height);
|
||||
const failRate = failedPixel / (width * height);
|
||||
if (failRate > 0) {
|
||||
(await jimp.read(actual)).scale(1).quality(100).write(parsePicPath(path.join(testResultDir, p.path)));
|
||||
(await jimp.read(diffBuf)).scale(1).quality(100).write(parsePicPath(path.join(diffDir, p.path)));
|
||||
}
|
||||
diffRateList.push({
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
# @idraw/core
|
||||
|
||||
* [] Options default data
|
||||
* [] Support gradient color
|
||||
* [] Listen keyboard action
|
||||
* [] Keep all num two decimals
|
||||
|
|
|
|||
|
|
@ -33,7 +33,11 @@
|
|||
contextWidth: 1000,
|
||||
contextHeight: 900,
|
||||
devicePixelRatio: 4,
|
||||
canScroll: true
|
||||
}, {
|
||||
scrollWrapper: {
|
||||
use: true,
|
||||
lineWidth: 20,
|
||||
}
|
||||
});
|
||||
core.initData(data);
|
||||
const result = core.scale(1);
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ class Core {
|
|||
this[_helper].updateConfig(this[_data], {
|
||||
width: this[_opts].width,
|
||||
height: this[_opts].height,
|
||||
canScroll: this[_opts].canScroll === true,
|
||||
canScroll: this[_config]?.scrollWrapper?.use === true,
|
||||
selectedUUID: this[_selectedUUID],
|
||||
selectedUUIDList: this[_selectedUUIDList],
|
||||
devicePixelRatio: this[_opts].devicePixelRatio,
|
||||
|
|
|
|||
|
|
@ -37,7 +37,8 @@ class IDraw extends Core {
|
|||
height: opts.height,
|
||||
contextWidth: opts.contextWidth,
|
||||
contextHeight: opts.contextHeight,
|
||||
devicePixelRatio: opts.devicePixelRatio
|
||||
devicePixelRatio: opts.devicePixelRatio,
|
||||
onlyRender: opts.onlyRender
|
||||
}, config || {});
|
||||
this[_opts] = this._createOpts(opts);
|
||||
this[_initEvent]();
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ type TypeCoreOptions = {
|
|||
devicePixelRatio: number;
|
||||
contextWidth: number;
|
||||
contextHeight: number;
|
||||
canScroll?: boolean;
|
||||
onlyRender?: boolean;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue