Skip to content

Commit

Permalink
feat: Add bounce stable velocity in settings
Browse files Browse the repository at this point in the history
  • Loading branch information
NriotHrreion committed Jan 1, 2025
1 parent f8f94dd commit 6883884
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 7 deletions.
10 changes: 10 additions & 0 deletions src/assets/defaultLocalSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,14 @@ export default {
maxValue: 1
}
},
stableVelocity: {
name: $("settings.stable-velocity"),
description: "v / m/s",
value: 5,
type: "input",
controlOptions: {
type: "number",
minValue: 1
}
},
} as GlobalSettingsList;
3 changes: 2 additions & 1 deletion src/locales/en-us.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,5 +73,6 @@
"settings.language.description": "Refreshing required",
"settings.gravity": "Gravity",
"settings.friction": "Ground Friction",
"settings.damping": "Ground Damping"
"settings.damping": "Ground Damping",
"settings.stable-velocity": "Bounce Stable Velocity"
}
3 changes: 2 additions & 1 deletion src/locales/zh-cn.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,5 +73,6 @@
"settings.language.description": "需刷新以生效",
"settings.gravity": "重力加速度",
"settings.friction": "地面摩擦系数",
"settings.damping": "地面阻尼系数"
"settings.damping": "地面阻尼系数",
"settings.stable-velocity": "弹跳稳定速度"
}
3 changes: 2 additions & 1 deletion src/locales/zh-tw.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,5 +73,6 @@
"settings.language.description": "需刷新以生效",
"settings.gravity": "重力加速度",
"settings.friction": "地面摩擦係數",
"settings.damping": "地面阻尼係數"
"settings.damping": "地面阻尼係數",
"settings.stable-velocity": "彈跳穩定速度"
}
2 changes: 1 addition & 1 deletion src/simulator/objects/ground.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export class Ground extends CanvasObject<GroundHitbox> {
public static readonly GROUND_HEIGHT = 25;
public static get DAMPING(): number { return Settings.get().getValue("damping"); };
public static get FRICTION(): number { return Settings.get().getValue("friction"); };
public static readonly STABLE_VELOCITY = 5;
public static get STABLE_VELOCITY(): number { return Settings.get().getValue("stableVelocity"); };

public readonly normalVector: Vector = new Vector(0, 1);

Expand Down
8 changes: 6 additions & 2 deletions src/ui/modal/modal.less
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,11 @@ dialog.modal-dialog {
}
}

&#settings .modal-dialog-body {
overflow-y: auto;
.scrollbar-style();
}

&#manager .modal-dialog-body {
display: flex;
gap: 5px;
Expand Down Expand Up @@ -219,8 +224,7 @@ dialog.modal-dialog {
}

&#settings .modal-dialog-body, &#object-settings .modal-dialog-body {
padding: 0 20px;
padding-top: 15px;
padding: 15px 20px;
}

&#import .modal-dialog-body {
Expand Down
2 changes: 1 addition & 1 deletion src/ui/modal/settingsModal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export class SettingsModal extends Modal {

this._addFooterButton("save", { text: $("modal.settings.save"), variant: "success", icon: Check }, "right", () => this._save());
this._addFooterButton("cancel", { text: $("modal.settings.cancel"), variant: "secondary" }, "right", () => this._cancel());
this._addFooterButton("recover", { text: $("modal.settings.recover"), variant: "danger" }, "left", () => this._recoverDefault());
this._addFooterButton("recover", { text: $("modal.settings.recover"), variant: "secondary" }, "left", () => this._recoverDefault());

// UI

Expand Down

0 comments on commit 6883884

Please sign in to comment.