Skip to content

Commit

Permalink
主要 替换opencv.js->@techstark/opencv-js
Browse files Browse the repository at this point in the history
  • Loading branch information
xushengfeng committed Jan 21, 2025
1 parent a92c718 commit 2916ebf
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 34 deletions.
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"license": "GPL-3.0",
"dependencies": {
"@erase2d/fabric": "^1.1.6",
"@techstark/opencv-js": "4.10.0-release.1",
"chroma-js": "^3.1.1",
"diff-match-patch": "^1.0.5",
"dkh-ui": "^0.12.4",
Expand All @@ -35,7 +36,6 @@
"mp4-muxer": "^5.1.3",
"node-screenshots": "^0.2.1",
"onnxruntime-node": "^1.18.0",
"opencv.js": "^1.2.1",
"qr-scanner-wechat": "^0.1.3",
"remarkable": "^2.0.1",
"sortablejs": "^1.15.2",
Expand Down Expand Up @@ -73,6 +73,8 @@
"node-screenshots-win32-x64-msvc": "0.1.9"
},
"pnpm": {
"neverBuiltDependencies": ["canvas"]
"neverBuiltDependencies": [
"canvas"
]
}
}
75 changes: 49 additions & 26 deletions pnpm-lock.yaml

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

12 changes: 6 additions & 6 deletions src/renderer/clip/clip_window.ts
Original file line number Diff line number Diff line change
Expand Up @@ -337,8 +337,7 @@ function edge() {
for (let i = 0; i < contours.size(); i++) {
const cnt = contours.get(i);
const r = cv.boundingRect(cnt);
r.type = "image";
edgeRect.push(r);
edgeRect.push({ ...r, type: "image" });
}

src.delete();
Expand Down Expand Up @@ -408,7 +407,8 @@ function setDefaultAction(act: setting["框选后默认操作"]) {
if (!act) return;
autoDo = act;
if (autoDo !== "no") {
toolBarEl.els[autoDo].el.style.backgroundColor = "var(--bar-focus-color)";
toolBarEl.els[autoDo].el.style.backgroundColor =
"var(--bar-focus-color)";
}
}

Expand Down Expand Up @@ -525,14 +525,14 @@ function long_s() {
s = null;
}

function startLong() {
async function startLong() {
initLong(finalRect);
const r = [...finalRect];
r[0] += screenPosition[nowScreenId].x;
r[1] += screenPosition[nowScreenId].y;
long_s();
ipcRenderer.send("clip_main_b", "long_s", r);
if (!cv) cv = require("opencv.js");
if (!cv) cv = require("@techstark/opencv-js");
if (store.get("广截屏.模式") === "自动") {
uIOhook = require("uiohook-napi").uIOhook;
uIOhook.start();
Expand Down Expand Up @@ -2752,7 +2752,7 @@ async function fabricCopy() {

if (store.get("框选.自动框选.图像识别")) {
// biome-ignore lint: 为了部分引入
var cv = require("opencv.js");
var cv = require("@techstark/opencv-js");
}

const 字体 = store.get("字体");
Expand Down

0 comments on commit 2916ebf

Please sign in to comment.