Skip to content

Commit 628a8a1

Browse files
committed
Dunno what changed but found changes
1 parent da15af5 commit 628a8a1

File tree

3 files changed

+66
-85
lines changed

3 files changed

+66
-85
lines changed

package.json

+21-21
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
{
2-
"name": "react-fractals",
3-
"version": "0.0.1",
4-
"private": true,
5-
"devDependencies": {
6-
"gh-pages": "^0.12.0",
7-
"react-scripts": "0.7.0"
8-
},
9-
"dependencies": {
10-
"d3-scale": "^1.0.4",
11-
"d3-selection": "^1.0.3",
12-
"react": "^15.4.0",
13-
"react-dom": "^15.4.0"
14-
},
15-
"homepage": "https://swizec.github.io/react-fractals",
16-
"scripts": {
17-
"start": "react-scripts start",
18-
"build": "react-scripts build",
19-
"test": "react-scripts test --env=jsdom",
20-
"eject": "react-scripts eject",
21-
"deploy": "gh-pages -d build"
22-
}
2+
"name": "react-fractals",
3+
"version": "0.0.1",
4+
"private": true,
5+
"devDependencies": {
6+
"gh-pages": "^0.12.0",
7+
"react-scripts": "0.7.0"
8+
},
9+
"dependencies": {
10+
"d3-scale": "^1.0.4",
11+
"d3-selection": "^1.0.3",
12+
"react": "^16.3.0-rc.0",
13+
"react-dom": "^16.3.0-rc.0"
14+
},
15+
"homepage": "https://swizec.github.io/react-fractals",
16+
"scripts": {
17+
"start": "react-scripts start",
18+
"build": "react-scripts build",
19+
"test": "react-scripts test --env=jsdom",
20+
"eject": "react-scripts eject",
21+
"deploy": "gh-pages -d build"
22+
}
2323
}

src/App.js

+29-39
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,10 @@
1-
import React, { Component } from 'react';
2-
import logo from './logo.svg';
3-
import './App.css';
4-
import { select as d3select, mouse as d3mouse } from 'd3-selection';
5-
import { scaleLinear } from 'd3-scale';
1+
import React, { Component } from "react";
2+
import logo from "./logo.svg";
3+
import "./App.css";
4+
import { select as d3select, mouse as d3mouse } from "d3-selection";
5+
import { scaleLinear } from "d3-scale";
66

7-
import Pythagoras from './Pythagoras';
8-
9-
10-
// borrowed from Vue fork https://github.com/yyx990803/vue-fractal/blob/master/src/App.vue
11-
function throttleWithRAF (fn) {
12-
let running = false
13-
return function () {
14-
if (running) return
15-
running = true
16-
window.requestAnimationFrame(() => {
17-
fn.apply(this, arguments)
18-
running = false
19-
})
20-
}
21-
}
7+
import Pythagoras from "./Pythagoras";
228

239
class App extends Component {
2410
svg = {
@@ -44,7 +30,7 @@ class App extends Component {
4430
const { currentMax } = this.state;
4531

4632
if (currentMax < this.realMax) {
47-
this.setState({currentMax: currentMax + 1});
33+
this.setState({ currentMax: currentMax + 1 });
4834
setTimeout(this.next.bind(this), 500);
4935
}
5036
}
@@ -57,12 +43,12 @@ class App extends Component {
5743
this.running = true;
5844

5945
const [x, y] = d3mouse(this.refs.svg),
60-
61-
scaleFactor = scaleLinear().domain([this.svg.height, 0])
62-
.range([0, .8]),
63-
64-
scaleLean = scaleLinear().domain([0, this.svg.width/2, this.svg.width])
65-
.range([.5, 0, -.5]);
46+
scaleFactor = scaleLinear()
47+
.domain([this.svg.height, 0])
48+
.range([0, 0.8]),
49+
scaleLean = scaleLinear()
50+
.domain([0, this.svg.width / 2, this.svg.width])
51+
.range([0.5, 0, -0.5]);
6652

6753
this.setState({
6854
heightFactor: scaleFactor(y),
@@ -79,18 +65,22 @@ class App extends Component {
7965
<h2>This is a dancing Pythagoras tree</h2>
8066
</div>
8167
<p className="App-intro">
82-
<svg width={this.svg.width} height={this.svg.height} ref="svg"
83-
style={{border: "1px solid lightgray"}}>
84-
85-
<Pythagoras w={this.state.baseW}
86-
h={this.state.baseW}
87-
heightFactor={this.state.heightFactor}
88-
lean={this.state.lean}
89-
x={this.svg.width/2-40}
90-
y={this.svg.height-this.state.baseW}
91-
lvl={0}
92-
maxlvl={this.state.currentMax}/>
93-
68+
<svg
69+
width={this.svg.width}
70+
height={this.svg.height}
71+
ref="svg"
72+
style={{ border: "1px solid lightgray" }}
73+
>
74+
<Pythagoras
75+
w={this.state.baseW}
76+
h={this.state.baseW}
77+
heightFactor={this.state.heightFactor}
78+
lean={this.state.lean}
79+
x={this.svg.width / 2 - 40}
80+
y={this.svg.height - this.state.baseW}
81+
lvl={0}
82+
maxlvl={this.state.currentMax}
83+
/>
9484
</svg>
9585
</p>
9686
</div>

yarn.lock

+16-25
Original file line numberDiff line numberDiff line change
@@ -1500,14 +1500,6 @@ cosmiconfig@^2.1.0, cosmiconfig@^2.1.1:
15001500
parse-json "^2.2.0"
15011501
require-from-string "^1.1.0"
15021502

1503-
create-react-class@^15.6.0:
1504-
version "15.6.2"
1505-
resolved "https://registry.yarnpkg.com/create-react-class/-/create-react-class-15.6.2.tgz#cf1ed15f12aad7f14ef5f2dfe05e6c42f91ef02a"
1506-
dependencies:
1507-
fbjs "^0.8.9"
1508-
loose-envify "^1.3.1"
1509-
object-assign "^4.1.1"
1510-
15111503
15121504
version "4.0.2"
15131505
resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-4.0.2.tgz#7b9247621c23adfdd3856004a823cbe397424d41"
@@ -2305,7 +2297,7 @@ fb-watchman@^1.8.0, fb-watchman@^1.9.0:
23052297
dependencies:
23062298
bser "1.0.2"
23072299

2308-
fbjs@^0.8.16, fbjs@^0.8.9:
2300+
fbjs@^0.8.16:
23092301
version "0.8.16"
23102302
resolved "https://registry.yarnpkg.com/fbjs/-/fbjs-0.8.16.tgz#5e67432f550dc41b572bf55847b8aca64e5337db"
23112303
dependencies:
@@ -4547,9 +4539,9 @@ promise@^7.1.1:
45474539
dependencies:
45484540
asap "~2.0.3"
45494541

4550-
prop-types@^15.5.10:
4551-
version "15.6.0"
4552-
resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.6.0.tgz#ceaf083022fc46b4a35f69e13ef75aed0d639856"
4542+
prop-types@^15.6.0:
4543+
version "15.6.1"
4544+
resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.6.1.tgz#36644453564255ddda391191fb3a125cbdf654ca"
45534545
dependencies:
45544546
fbjs "^0.8.16"
45554547
loose-envify "^1.3.1"
@@ -4673,14 +4665,14 @@ react-dev-utils@^0.3.0:
46734665
sockjs-client "1.0.3"
46744666
strip-ansi "3.0.1"
46754667

4676-
react-dom@^15.4.0:
4677-
version "15.6.2"
4678-
resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-15.6.2.tgz#41cfadf693b757faf2708443a1d1fd5a02bef730"
4668+
react-dom@^16.3.0-rc.0:
4669+
version "16.3.0-rc.0"
4670+
resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-16.3.0-rc.0.tgz#18282bcc98496197877b9365467362caf74b8e45"
46794671
dependencies:
4680-
fbjs "^0.8.9"
4672+
fbjs "^0.8.16"
46814673
loose-envify "^1.1.0"
4682-
object-assign "^4.1.0"
4683-
prop-types "^15.5.10"
4674+
object-assign "^4.1.1"
4675+
prop-types "^15.6.0"
46844676

46854677
46864678
version "0.7.0"
@@ -4733,15 +4725,14 @@ [email protected]:
47334725
optionalDependencies:
47344726
fsevents "1.0.14"
47354727

4736-
react@^15.4.0:
4737-
version "15.6.2"
4738-
resolved "https://registry.yarnpkg.com/react/-/react-15.6.2.tgz#dba0434ab439cfe82f108f0f511663908179aa72"
4728+
react@^16.3.0-rc.0:
4729+
version "16.3.0-rc.0"
4730+
resolved "https://registry.yarnpkg.com/react/-/react-16.3.0-rc.0.tgz#07ddbe3ef14b910038576ef4afb29793d9e20f84"
47394731
dependencies:
4740-
create-react-class "^15.6.0"
4741-
fbjs "^0.8.9"
4732+
fbjs "^0.8.16"
47424733
loose-envify "^1.1.0"
4743-
object-assign "^4.1.0"
4744-
prop-types "^15.5.10"
4734+
object-assign "^4.1.1"
4735+
prop-types "^15.6.0"
47454736

47464737
read-pkg-up@^1.0.1:
47474738
version "1.0.1"

0 commit comments

Comments
 (0)