Skip to content

Commit 0b9ee47

Browse files
committed
Add "Scale (both)" option and fix quotes
1 parent 3e710e6 commit 0b9ee47

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed

src/playground/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
<option value="direction">Direction</option>
1717
<option value="scalex">Scale X</option>
1818
<option value="scaley">Scale Y</option>
19+
<option value="scaleboth">Scale (both dimensions)</option>
1920
<option value="color">Color</option>
2021
<option value="fisheye">Fisheye</option>
2122
<option value="whirl">Whirl</option>

src/playground/playground.js

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -62,25 +62,25 @@ const fudgeMaxInput = document.getElementById('fudgeMax');
6262
fudgeMaxInput.addEventListener('change', updateFudgeMax);
6363
fudgeMaxInput.addEventListener('init', updateFudgeMax);
6464

65-
function updateFudgeProperty(event) {
65+
function updateFudgeProperty (event) {
6666
fudgeProperty = event.target.value;
6767
}
6868

69-
function updateFudgeMin(event) {
69+
function updateFudgeMin (event) {
7070
fudgeInput.min = event.target.valueAsNumber;
7171
}
7272

73-
function updateFudgeMax(event) {
73+
function updateFudgeMax (event) {
7474
fudgeInput.max = event.target.valueAsNumber;
7575
}
7676

7777
// Ugly hack to properly set the values of the inputs on page load,
7878
// since they persist across reloads, at least in Firefox.
7979
// The best ugly hacks are the ones that reduce code duplication!
80-
fudgePropertyInput.dispatchEvent(new CustomEvent("init"));
81-
fudgeMinInput.dispatchEvent(new CustomEvent("init"));
82-
fudgeMaxInput.dispatchEvent(new CustomEvent("init"));
83-
fudgeInput.dispatchEvent(new CustomEvent("init"));
80+
fudgePropertyInput.dispatchEvent(new CustomEvent('init'));
81+
fudgeMinInput.dispatchEvent(new CustomEvent('init'));
82+
fudgeMaxInput.dispatchEvent(new CustomEvent('init'));
83+
fudgeInput.dispatchEvent(new CustomEvent('init'));
8484

8585
const handleFudgeChanged = function (event) {
8686
fudge = event.target.valueAsNumber;
@@ -105,6 +105,11 @@ const handleFudgeChanged = function (event) {
105105
props.scale = [scaleX, fudge];
106106
scaleY = fudge;
107107
break;
108+
case 'scaleboth':
109+
props.scale = [fudge, fudge];
110+
scaleX = fudge;
111+
scaleY = fudge;
112+
break;
108113
case 'color':
109114
props.color = fudge;
110115
break;
@@ -134,12 +139,12 @@ fudgeInput.addEventListener('input', handleFudgeChanged);
134139
fudgeInput.addEventListener('change', handleFudgeChanged);
135140
fudgeInput.addEventListener('init', handleFudgeChanged);
136141

137-
const stageScaleInput = document.getElementById("stage-scale");
142+
const stageScaleInput = document.getElementById('stage-scale');
138143

139144
stageScaleInput.addEventListener('input', updateStageScale);
140145
stageScaleInput.addEventListener('change', updateStageScale);
141146

142-
function updateStageScale(event) {
147+
function updateStageScale (event) {
143148
renderer.resize(480 * event.target.valueAsNumber, 360 * event.target.valueAsNumber);
144149
}
145150

0 commit comments

Comments
 (0)