Skip to content

Commit 90f12c1

Browse files
committed
⚡ 去除console.log
1 parent b7ed672 commit 90f12c1

27 files changed

+75
-240
lines changed

src/core/ColorManager.tsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,8 @@ export namespace ColorManager {
6969
* @param color
7070
*/
7171
export async function removeUserEntityFillColor(color: Color) {
72-
console.log("删除颜色:", color);
7372
const colors = await getUserEntityFillColors();
74-
console.log("查询到的颜色:", colors);
7573
const colorData = colorToColorData(colors);
76-
console.log("查询到的颜色数据:", colorData);
7774

7875
let index = -1;
7976
for (let i = 0; i < colorData.length; i++) {
@@ -88,7 +85,6 @@ export namespace ColorManager {
8885
break;
8986
}
9087
}
91-
console.log("查询到的颜色索引:", index);
9288

9389
if (index >= 0) {
9490
colors.splice(index, 1);

src/core/KeyBinds.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,6 @@ export namespace KeyBinds {
116116
const obj = new _Bind(id, data.key, data.modifiers);
117117
// 监听快捷键变化
118118
await watch(id, (key, modifiers) => {
119-
console.log(
120-
`Keybind ${id} changed to ${key} with modifiers ${modifiers}`,
121-
);
122119
obj.key = key;
123120
obj.modifiers = modifiers;
124121
});

src/core/SoundService.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ export namespace SoundService {
7676

7777
async function loadAndPlaySound(filePath: string) {
7878
if (filePath.trim() === "") {
79-
console.log("filePath is empty");
8079
return;
8180
}
8281

src/core/controller/concrete/ControllerCamera.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,6 @@ ControllerCamera.mousemove = (event: MouseEvent) => {
171171
return;
172172
}
173173
if (entity !== null) {
174-
console.log("右键在实体上了");
175174
return;
176175
}
177176
moveCameraByMouseMove(event.clientX, event.clientY, 2);

src/core/controller/concrete/ControllerDragFile.tsx

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { v4 as uuidv4 } from "uuid";
12
import { writeFileBase64 } from "../../../utils/fs";
23
import { PathString } from "../../../utils/pathString";
34
import { Color } from "../../dataStruct/Color";
@@ -11,7 +12,6 @@ import { StageManager } from "../../stage/stageManager/StageManager";
1112
import { ImageNode } from "../../stageObject/entity/ImageNode";
1213
import { TextNode } from "../../stageObject/entity/TextNode";
1314
import { ControllerClassDragFile } from "../ControllerClassDragFile";
14-
import { v4 as uuidv4 } from "uuid";
1515
// import { listen } from "@tauri-apps/api/event";
1616

1717
// listen("tauri://file-drop", (event) => {
@@ -69,7 +69,6 @@ ControllerDragFile.drop = (event: DragEvent) => {
6969
// const firstFile = files[0]; // 获取第一个拖入的文件
7070
let i = -1;
7171
for (const file of files) {
72-
console.log("filt type:", file.type);
7372
i++;
7473
if (file.type.includes("json")) {
7574
dealJsonFileDrop(file, mouseWorldLocation);
@@ -84,7 +83,6 @@ ControllerDragFile.drop = (event: DragEvent) => {
8483
}
8584
});
8685
} else if (file.type.includes("image/png")) {
87-
console.log("是图片");
8886
dealPngFileDrop(file, mouseWorldLocation);
8987
} else {
9088
if (file.name.endsWith(".md")) {
@@ -191,14 +189,11 @@ function dealPngFileDrop(file: File, mouseWorldLocation: Vector) {
191189
return;
192190
}
193191

194-
console.log(fileContent);
195192
// 正常情况下,fileContent打印出来是 string类型的东西:
196193
// data:image/png;base64,iVBORw0KGgoAAAANS...
197-
console.log(typeof fileContent);
198-
// // 在这里处理读取到的内容
194+
// 在这里处理读取到的内容
199195
const imageUUID = uuidv4();
200196
const folderPath = PathString.dirPath(Stage.Path.getFilePath());
201-
console.log(folderPath); // D:\Desktop\xxx\xxx.json
202197
writeFileBase64(
203198
`${folderPath}${Stage.Path.getSep()}${imageUUID}.png`,
204199
fileContent.split(",")[1],

src/core/controller/concrete/ControllerEntityLayerMoving.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ ControllerLayerMoving.mouseup = (event: MouseEvent) => {
3838
// 即将跳入的sections区域
3939
const targetSections =
4040
StageManager.SectionOptions.getSectionsByInnerLocation(mouseLocation);
41-
console.log(targetSections);
4241
const selectedEntities = StageManager.getSelectedEntities();
4342
// 移动位置
4443

src/core/controller/concrete/ControllerNodeMove.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ ControllerNodeMove.mousedown = (event: MouseEvent) => {
2323
const clickedEntity =
2424
StageManager.findConnectableEntityByLocation(pressWorldLocation);
2525
if (clickedEntity !== null) {
26-
console.log("clickedEntity", clickedEntity);
2726
Controller.isMovingEntity = true;
2827
if (clickedEntity && !clickedEntity.isSelected) {
2928
StageManager.getEntities().forEach((entity) => {

src/core/effect/concrete/EntityAlignEffect.tsx

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,6 @@ export class EntityAlignEffect extends Effect {
7979
),
8080
);
8181
}
82-
// console.log(this.lines, this.lines.length);
83-
// console.log(
84-
// moveEntityRectangle.toString(),
85-
// targetEntityRectangle.toString(),
86-
// );
8782
}
8883

8984
render(): void {

src/core/render/canvas2d/entityRenderer/edge/EdgeRenderer.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,6 @@ export namespace EdgeRenderer {
184184
edge.source.isHiddenBySectionCollapse &&
185185
edge.target.isHiddenBySectionCollapse
186186
) {
187-
console.log("隐藏了");
188187
return <></>;
189188
}
190189

src/core/render/canvas2d/entityRenderer/edge/concrete/StraightEdgeRenderer.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -182,12 +182,10 @@ export class StraightEdgeRenderer extends EdgeRendererClass {
182182
</>
183183
);
184184
}
185-
public getCycleStageSvg(edge: LineEdge): React.ReactNode {
186-
console.log(edge);
185+
public getCycleStageSvg(): React.ReactNode {
187186
return <></>;
188187
}
189-
public getShiftingStageSvg(edge: LineEdge): React.ReactNode {
190-
console.log(edge);
188+
public getShiftingStageSvg(): React.ReactNode {
191189
return <></>;
192190
}
193191

src/core/render/canvas2d/entityRenderer/edge/concrete/SymmetryCurveEdgeRenderer.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -217,12 +217,10 @@ export class SymmetryCurveEdgeRenderer extends EdgeRendererClass {
217217
</>
218218
);
219219
}
220-
public getCycleStageSvg(edge: LineEdge): React.ReactNode {
221-
console.log(edge);
220+
public getCycleStageSvg(): React.ReactNode {
222221
return <></>;
223222
}
224-
public getShiftingStageSvg(edge: LineEdge): React.ReactNode {
225-
console.log(edge);
223+
public getShiftingStageSvg(): React.ReactNode {
226224
return <></>;
227225
}
228226
public renderVirtualEdge(

src/core/render/canvas2d/entityRenderer/edge/concrete/VerticalPolyEdgeRenderer.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -489,12 +489,10 @@ export class VerticalPolyEdgeRenderer extends EdgeRendererClass {
489489
</>
490490
);
491491
}
492-
public getCycleStageSvg(edge: LineEdge): React.ReactNode {
493-
console.log(edge);
492+
public getCycleStageSvg(): React.ReactNode {
494493
return <></>;
495494
}
496-
public getShiftingStageSvg(edge: LineEdge): React.ReactNode {
497-
console.log(edge);
495+
public getShiftingStageSvg(): React.ReactNode {
498496
return <></>;
499497
}
500498

src/core/stage/Camera.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,6 @@ export namespace Camera {
258258
}
259259

260260
export function resetBySelected() {
261-
console.log("resetBySelected");
262261
const selectedEntity: Entity[] = StageManager.getSelectedEntities();
263262
if (selectedEntity.length === 0) {
264263
reset();
@@ -281,7 +280,6 @@ export namespace Camera {
281280
Renderer.w / selectedRectangleSize.x,
282281
),
283282
);
284-
console.log("currentScale", Camera.currentScale);
285283
Camera.targetScale = Camera.currentScale;
286284
}
287285

src/core/stage/keyboardOnlyEngine/keyboardOnlyEngine.tsx

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1+
import { Dialog } from "../../../utils/dialog";
2+
import { editTextNode } from "../../controller/concrete/utilsControl";
13
import { Vector } from "../../dataStruct/Vector";
4+
import { EdgeRenderer } from "../../render/canvas2d/entityRenderer/edge/EdgeRenderer";
5+
import { ConnectableEntity } from "../../stageObject/StageObject";
26
import { Camera } from "../Camera";
7+
import { Stage } from "../Stage";
38
import { StageManager } from "../stageManager/StageManager";
4-
import { ConnectableEntity } from "../../stageObject/StageObject";
5-
import { Dialog } from "../../../utils/dialog";
6-
import { editTextNode } from "../../controller/concrete/utilsControl";
7-
import { SelectChangeEngine } from "./selectChangeEngine";
89
import { KeyboardOnlyDirectionController } from "./keyboardOnlyDirectionController";
9-
import { Stage } from "../Stage";
10-
import { EdgeRenderer } from "../../render/canvas2d/entityRenderer/edge/EdgeRenderer";
1110
import { NewTargetLocationSelector } from "./newTargetLocationSelector";
11+
import { SelectChangeEngine } from "./selectChangeEngine";
1212

1313
/**
1414
* 纯键盘控制的相关引擎
@@ -37,7 +37,6 @@ export namespace KeyboardOnlyEngine {
3737
* 仅在最开始调用一次
3838
*/
3939
function bindKeyEvents() {
40-
console.log("bindKeyEvents");
4140
window.addEventListener("keydown", (event) => {
4241
if (event.key === "Tab") {
4342
if (isEnableVirtualCreate()) {

src/core/stage/stageManager/StageManager.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,6 @@ export namespace StageManager {
262262
* 包含了对Edge双向线偏移状态的更新
263263
*/
264264
export function updateReferences() {
265-
console.log("updateReferences");
266265
for (const entity of getEntities()) {
267266
if (entity instanceof ConnectableEntity) {
268267
for (const edge of getLineEdges()) {

src/core/stage/stageManager/concreteMethods/StageAutoAlignManager.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,6 @@ export namespace StageAutoAlignManager {
115115
}
116116
}
117117
if (isAlign && isPreAlign) {
118-
console.log("显示预先对齐效果");
119118
// 预先对齐显示反馈
120119
const rectangle = selectedEntity.collisionBox.getRectangle();
121120
const moveTargetRectangle = rectangle.clone();

src/core/stage/stageManager/concreteMethods/StageGeneratorAI.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,7 @@ export namespace StageGeneratorAI {
5959
}
6060

6161
return expandArrayList; // 返回扩展的字符串数组
62-
} catch (error) {
63-
console.log("AiFetcherOneShotCloudFlare error", error);
62+
} catch {
6463
return ["error"];
6564
}
6665
}

src/core/stage/stageManager/concreteMethods/StageNodeConnector.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import { v4 as uuidv4 } from "uuid";
2+
import { CublicCatmullRomSplineEdge } from "../../../stageObject/association/CublicCatmullRomSplineEdge";
23
import { LineEdge } from "../../../stageObject/association/LineEdge";
34
import { ConnectPoint } from "../../../stageObject/entity/ConnectPoint";
45
import { ConnectableEntity } from "../../../stageObject/StageObject";
56
import { StageManager } from "../StageManager";
67
import { StageDeleteManager } from "./StageDeleteManager";
7-
import { CublicCatmullRomSplineEdge } from "../../../stageObject/association/CublicCatmullRomSplineEdge";
88

99
/**
1010
* 集成所有连线相关的功能
@@ -66,12 +66,10 @@ export namespace StageNodeConnector {
6666
toNode: ConnectableEntity,
6767
): void {
6868
if (!isConnectable(fromNode, toNode)) {
69-
console.log("这两个点无法连接");
7069
return;
7170
}
7271
const newEdge = CublicCatmullRomSplineEdge.fromTwoEntity(fromNode, toNode);
7372
StageManager.addCrEdge(newEdge);
74-
console.log(newEdge);
7573
StageManager.updateReferences();
7674
}
7775

src/core/stageObject/association/CublicCatmullRomSplineEdge.tsx

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1+
import { v4 as uuidv4 } from "uuid";
12
import { Serialized } from "../../../types/node";
23
import { CublicCatmullRomSpline } from "../../dataStruct/shape/CublicCatmullRomSpline";
34
import { Vector } from "../../dataStruct/Vector";
45
import { CollisionBox } from "../collisionBox/collisionBox";
56
import { TextNode } from "../entity/TextNode";
67
import { ConnectableEntity } from "../StageObject";
78
import { Edge } from "./Edge";
8-
import { v4 as uuidv4 } from "uuid";
99

1010
/**
1111
* CR曲线连线
@@ -77,7 +77,6 @@ export class CublicCatmullRomSplineEdge extends Edge {
7777
this._collisionBox = new CollisionBox([
7878
new CublicCatmullRomSpline(this.controlPoints, this.alpha, this.tension),
7979
]);
80-
console.log("构造函数执行了");
8180
}
8281

8382
public getShape(): CublicCatmullRomSpline {
@@ -88,7 +87,6 @@ export class CublicCatmullRomSplineEdge extends Edge {
8887
}
8988

9089
autoUpdateControlPoints() {
91-
console.log("自动更新控制点");
9290
// 只更新起始点和结束点
9391
const startLocation = this._source.collisionBox.getRectangle().center;
9492
const endLocation = this._target.collisionBox.getRectangle().center;
@@ -100,11 +98,5 @@ export class CublicCatmullRomSplineEdge extends Edge {
10098
];
10199
}
102100

103-
private test() {
104-
console.log(this.alpha, this.tension, this.controlPoints);
105-
}
106-
107-
adjustSizeByText(): void {
108-
this.test();
109-
}
101+
adjustSizeByText(): void {}
110102
}

src/core/stageObject/entity/ImageNode.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,6 @@ export class ImageNode extends ConnectableEntity {
168168
}
169169

170170
public scaleUpdate(scaleDiff: number) {
171-
console.log("scaleUpdate");
172171
this.scaleNumber += scaleDiff;
173172
if (this.scaleNumber < 0.1) {
174173
this.scaleNumber = 0.1;

src/main.tsx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,21 +23,21 @@ import { Renderer } from "./core/render/canvas2d/renderer";
2323
import { Settings } from "./core/Settings";
2424
import { SoundService } from "./core/SoundService";
2525
import { Camera } from "./core/stage/Camera";
26+
import { KeyboardOnlyEngine } from "./core/stage/keyboardOnlyEngine/keyboardOnlyEngine";
2627
import { Stage } from "./core/stage/Stage";
2728
import { StageHistoryManager } from "./core/stage/stageManager/StageHistoryManager";
2829
import { StageManager } from "./core/stage/stageManager/StageManager";
2930
import { EdgeCollisionBoxGetter } from "./core/stageObject/association/EdgeCollisionBoxGetter";
3031
import { StageStyleManager } from "./core/stageStyle/StageStyleManager";
3132
import { StartFilesManager } from "./core/StartFilesManager";
3233
import "./index.pcss";
34+
import { ColorPanel } from "./pages/_toolbar";
3335
import "./polyfills/roundRect";
3436
import { Dialog } from "./utils/dialog";
3537
import { exists } from "./utils/fs";
3638
import { exit, openDevtools, writeStderr, writeStdout } from "./utils/otherApi";
3739
import { getCurrentWindow, isDesktop, isWeb } from "./utils/platform";
3840
import { Popup } from "./utils/popup";
39-
import { ColorPanel } from "./pages/_toolbar";
40-
import { KeyboardOnlyEngine } from "./core/stage/keyboardOnlyEngine/keyboardOnlyEngine";
4141

4242
const router = createMemoryRouter(routes);
4343
const Routes = () => <RouterProvider router={router} />;
@@ -47,7 +47,6 @@ const el = document.getElementById("root")!;
4747
// 在这里看着清爽一些,像一个列表清单一样。也方便调整顺序
4848

4949
(async () => {
50-
const t1 = performance.now();
5150
const matches = !isWeb ? await getMatches() : null;
5251
const isCliMode = isDesktop && matches?.args.output?.occurrences === 1;
5352
await Promise.all([
@@ -67,7 +66,6 @@ const el = document.getElementById("root")!;
6766
registerKeyBinds(),
6867
]);
6968
await renderApp(isCliMode);
70-
console.log(`应用初始化耗时:${performance.now() - t1}ms`);
7169
if (isCliMode) {
7270
try {
7371
await runCli(matches);
@@ -99,7 +97,6 @@ async function loadSyncModules() {
9997
*/
10098
async function registerKeyBinds() {
10199
// 开始注册快捷键
102-
console.log("注册快捷键");
103100
(
104101
await KeyBinds.create("test", "t", {
105102
control: true,

src/pages/_app.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,13 +109,13 @@ export default function App() {
109109
content: "您现在的新建草稿没有保存,是否要关闭项目?",
110110
buttons: [
111111
{
112-
text: "直接关闭,这个草稿不值得保存",
112+
text: "不保存",
113113
onClick: async () => {
114114
await getCurrentWindow().destroy();
115115
},
116116
},
117117
{
118-
text: "啊不不不,我要另存为",
118+
text: "取消",
119119
},
120120
],
121121
});

0 commit comments

Comments
 (0)