Skip to content

Commit 597bc46

Browse files
authored
Merge branch 'dev-2.0' into fix/filter-size
2 parents b6a3887 + f8e1c32 commit 597bc46

File tree

7 files changed

+22
-17
lines changed

7 files changed

+22
-17
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@
8282
"./core": {
8383
"default": "./dist/core/main.js"
8484
},
85+
"./color": "./dist/color/index.js",
8586
"./shape": "./dist/shape/index.js",
8687
"./accessibility": "./dist/accessibility/index.js",
8788
"./friendlyErrors": "./dist/core/friendlyErrors/index.js",

src/core/p5.Renderer2D.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,14 +70,18 @@ class Renderer2D extends Renderer {
7070
}
7171
this.scale(this._pixelDensity, this._pixelDensity);
7272

73-
if(!this.filterRenderer){
74-
this.filterRenderer = new FilterRenderer2D(this);
75-
}
7673
// Set and return p5.Element
7774
this.wrappedElt = new Element(this.elt, this._pInst);
7875
this.clipPath = null;
7976
}
8077

78+
get filterRenderer() {
79+
if (!this._filterRenderer) {
80+
this._filterRenderer = new FilterRenderer2D(this);
81+
}
82+
return this._filterRenderer;
83+
}
84+
8185
remove(){
8286
this.wrappedElt.remove();
8387
this.wrappedElt = null;

test/manual-test-examples/async/loadJSON_callback/sketch.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,8 @@ function getWeather() {
3636

3737
var cityName = userInput.value();
3838
var URL =
39-
'http://api.openweathermap.org/data/2.5/weather?q=' +
40-
cityName +
41-
'&units=metric';
39+
'https://wttr.in/' + encodeURIComponent(cityName) + '?format=j1';
40+
4241
result = loadJSON(URL, displayWeather); // displayWeather is the callback
4342
}
4443

@@ -47,9 +46,9 @@ function displayWeather() {
4746
print(result); // result is ready!
4847

4948
var location = result.name;
50-
var currentTemp = result.main.temp;
49+
var avgTemp = result.weather[0].avgtempC;
5150
text(
52-
'Current temperature in ' + location + ' is ' + currentTemp + ' celsius',
51+
'Today\'s average temperature in ' + location + ' is ' + avgTemp + ' celsius',
5352
width / 2,
5453
height / 2
5554
);

test/manual-test-examples/async/loadJSON_options/sketch.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
function setup() {
22
noCanvas();
33
loadJSON(
4-
'http://api.openweathermap.org/data/2.5/station?id=5091',
4+
'https://wttr.in/Berlin?format=j1',
55
parseStuff,
66
'json'
77
);

test/manual-test-examples/async/loadJSON_preload/sketch.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// In this example, we want to load JSON (a JavaScript Object)
2-
// from a URL at openweathermap.org, and display it in setup().
2+
// from a URL at wttr.in, and display it in setup().
33
//
44
// Since setup() happens faster than you can load a website, the
55
// data does not have time to properly load before setup() is done.
@@ -13,7 +13,7 @@ var result;
1313

1414
function preload() {
1515
result = loadJSON(
16-
'http://api.openweathermap.org/data/2.5/weather?id=5128581&units=imperial'
16+
'https://wttr.in/Berlin?format=j1'
1717
);
1818
console.log('In preload(), the result has not finished loading: ');
1919
console.log(result);
@@ -29,10 +29,10 @@ function setup() {
2929
console.log('In setup(), here is the result: ');
3030
console.log(result);
3131

32-
var location = result.name;
33-
var currentTemp = result.main.temp;
32+
var location = result.nearest_area[0].areaName[0].value;
33+
var avgTemp = result.weather[0].avgtempC;
3434
text(
35-
'Current temperature in ' + location + ' is ' + currentTemp + 'F',
35+
'Today\'s average temperature in ' + location + ' is ' + avgTemp + ' celsius',
3636
width / 2,
3737
height / 2
3838
);

test/manual-test-examples/dom/radio_test/sketch.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ function setup() {
55
radio.id('test');
66
//radio = createSelect(); // for comparison
77

8-
// just mucking around
8+
// The first is the value; the second is the optional label
99
radio.option('apple', '1');
1010
radio.option('orange', '2');
1111
radio.option('pear');
1212

1313
// Set what it starts as
14-
radio.selected('2');
14+
radio.selected('orange');
1515

1616
radio.changed(mySelectEvent);
1717
}
@@ -24,7 +24,7 @@ function draw() {
2424
}
2525

2626
function mySelectEvent() {
27-
var selected = this.selected();
27+
var selected = this.selected().value;
2828
console.log(this.value());
2929
if (selected === 'pear') {
3030
console.log("it's a pear!");

test/manual-test-examples/keyboard/keyIsPressed.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,6 @@
66
</head>
77

88
<body>
9+
<p>Press the arrow keys, colors should change.</p>
910
</body>
1011
</html>

0 commit comments

Comments
 (0)