Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update spawn positions #12

Merged
merged 1 commit into from
Feb 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/position.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ export class Position {
}

private generateRandomNumByRange(range: string): number {
let rangeArr = range.split("-");
let rangeArr = range.split("~");
if (rangeArr.length === 1) {
return parseFloat(rangeArr[0]);
}
Expand All @@ -143,7 +143,7 @@ export class Position {

let min = parseFloat(rangeArr[0]);
let max = parseFloat(rangeArr[1]);
if (max > min) {
if (max < min) {
throw new Error("invalid range parameter: " + range);
}
return Math.random() * (max - min) + min;
Expand Down
22 changes: 20 additions & 2 deletions templates/main.html
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,15 @@ <h6 class="display-6 my-4">Initial settings</h6>
</div>
<div class="col-md-6 col-12">
<select class="form-select" id="initSettingsSpawnPosition">
<option value="35.6938,139.7034" selected>Shinjuku (Tokyo)</option>
<option value="34.9665426~34.9685208,135.773909~135.7794773" selected>Fushimi Inari Taisha, Kyoto,
Japan</option>
<option value="39.1980915~39.2199991,20.1296786~20.1488678">Paxos, Paxi, Greece</option>
<option value="51.4728434~51.4818911,-0.0087936~0.005465">Royal Observatory Greenwich, London, United
Kingdom</option>
<option value="37.3702118~37.4328045,-122.1336276~-122.0798976">Mountain View, California, USA</option>
<option value="41.4030585~41.4043461,2.171856~2.1735619">La Sagrada Familia, Barcelona, Spain</option>
<option value="48.635264~48.6369727,-1.5140238~-1.5110787">Mont Saint-Michel, France</option>
<option value="22.5384699~22.5541258,114.0696698~114.0933162">Shenzhen, China</option>
</select>
</div>
</div>
Expand Down Expand Up @@ -414,7 +422,17 @@ <h5 class="modal-title">Settings</h5>
</div>
<div class="col-md-6 col-12">
<select class="form-select" id="settingsSpawnPosition">
<option value="35.6938,139.7034" selected>Shinjuku (Tokyo)</option>
<option value="34.9665426~34.9685208,135.773909~135.7794773" selected>Fushimi Inari Taisha, Kyoto,
Japan</option>
<option value="39.1980915~39.2199991,20.1296786~20.1488678">Paxos, Paxi, Greece</option>
<option value="51.4728434~51.4818911,-0.0087936~0.005465">Royal Observatory Greenwich, London,
United Kingdom</option>
<option value="37.3702118~37.4328045,-122.1336276~-122.0798976">Mountain View, California, USA
</option>
<option value="41.4030585~41.4043461,2.171856~2.1735619">La Sagrada Familia, Barcelona, Spain
</option>
<option value="48.635264~48.6369727,-1.5140238~-1.5110787">Mont Saint-Michel, France</option>
<option value="22.5384699~22.5541258,114.0696698~114.0933162">Shenzhen, China</option>
</select>
</div>
</div>
Expand Down
Loading