Skip to content

Commit

Permalink
Adding function for Yassin
Browse files Browse the repository at this point in the history
  • Loading branch information
Bubobubobubobubo committed Oct 18, 2023
1 parent f55c569 commit 9e08bfc
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ <h2 class="font-semibold lg:text-xl text-gray-400">More</h2>
<p class="text-semibold text-2xl pb-4">Known universes</p>
<p id="existing-universes" class="text-xl"></p>
<div id="disclaimer" class="pb-4">
<form id="universe-creator">
<form id="universe-creator">
<label for="search" class="mb-2 text-sm font-medium text-gray-900 sr-only text-white">Search</label>
<div class="relative">
<div class="absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none">
Expand Down
10 changes: 10 additions & 0 deletions src/API.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1739,6 +1739,16 @@ export class UserAPI {
return sum / values.length;
};

public range = (
inputY: number, yMin: number,
yMax: number, xMin: number,
xMax: number): number => {
const percent = (inputY - yMin) / (yMax - yMin);
const outputX = percent * (xMax - xMin) + xMin;
return outputX;
};


limit = (value: number, min: number, max: number): number => {
/**
* Limits a value between a minimum and a maximum.
Expand Down

0 comments on commit 9e08bfc

Please sign in to comment.