refactor: core stage
This commit is contained in:
parent
ce52fc2ce1
commit
2af8f13b31
|
@ -22,6 +22,7 @@
|
||||||
"test.js.map"
|
"test.js.map"
|
||||||
],
|
],
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@avocado/graphics": "^2.0.0",
|
||||||
"@latus/core": "^2.0.0",
|
"@latus/core": "^2.0.0",
|
||||||
"@latus/react": "^2.0.0",
|
"@latus/react": "^2.0.0",
|
||||||
"autoprefixer": "^9.8.6",
|
"autoprefixer": "^9.8.6",
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import {projects, user} from './state';
|
import {projects, user} from './state';
|
||||||
|
|
||||||
|
export {default as Stage} from './stage';
|
||||||
export * from './state';
|
export * from './state';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
|
44
packages/core/src/stage/index.jsx
Normal file
44
packages/core/src/stage/index.jsx
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
import './index.scss';
|
||||||
|
|
||||||
|
import {Renderer} from '@avocado/graphics';
|
||||||
|
import {PropTypes, React} from '@latus/react';
|
||||||
|
|
||||||
|
const {
|
||||||
|
useEffect,
|
||||||
|
useRef,
|
||||||
|
} = React;
|
||||||
|
|
||||||
|
const Stage = ({renderable, size, ticker}) => {
|
||||||
|
const ref = useRef();
|
||||||
|
useEffect(() => {
|
||||||
|
if (!ref.current || !renderable) {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
const container = ref.current;
|
||||||
|
const renderer = new Renderer(size);
|
||||||
|
ref.current.appendChild(renderer.element);
|
||||||
|
const handle = setInterval(() => {
|
||||||
|
ticker(0.03);
|
||||||
|
renderer.render(renderable);
|
||||||
|
}, 33.33);
|
||||||
|
return () => {
|
||||||
|
if (renderer) {
|
||||||
|
container.removeChild(renderer.element);
|
||||||
|
}
|
||||||
|
if (handle) {
|
||||||
|
clearInterval(handle);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}, [ref, renderable, size, ticker]);
|
||||||
|
return (
|
||||||
|
<div className="stage" ref={ref} />
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
Stage.propTypes = {
|
||||||
|
renderable: PropTypes.shape({}).isRequired,
|
||||||
|
size: PropTypes.arrayOf(PropTypes.number).isRequired,
|
||||||
|
ticker: PropTypes.func.isRequired,
|
||||||
|
};
|
||||||
|
|
||||||
|
export default Stage;
|
0
packages/core/src/stage/index.scss
Normal file
0
packages/core/src/stage/index.scss
Normal file
|
@ -2,6 +2,96 @@
|
||||||
# yarn lockfile v1
|
# yarn lockfile v1
|
||||||
|
|
||||||
|
|
||||||
|
"@avocado/core@2.0.0", "@avocado/core@^2.0.0":
|
||||||
|
version "2.0.0"
|
||||||
|
resolved "http://npm.cha0sdev/@avocado%2fcore/-/core-2.0.0.tgz#c18b0f64e4503c1a9dec67586f7ebf9bda5d129e"
|
||||||
|
integrity sha512-XVFaKJ89ajw+Sw9uwFgYblRduOiZ0un5gXu7eSbN2LAA+KjyrvfCcLNnYVKJZ67njkMGLq9nE2GSzZEeEmbkfA==
|
||||||
|
dependencies:
|
||||||
|
autoprefixer "^9.8.6"
|
||||||
|
debug "4.3.1"
|
||||||
|
|
||||||
|
"@avocado/graphics@^2.0.0":
|
||||||
|
version "2.0.0"
|
||||||
|
resolved "http://npm.cha0sdev/@avocado%2fgraphics/-/graphics-2.0.0.tgz#c250194c245a8cef4b233b470b6afa3f7710ee6c"
|
||||||
|
integrity sha512-yZMCSPvAT32wjKW1cJ20nUs9QYtPBE3M7tdw1iaDR4oLQnKrdX2bRAUdhotJc1SFCMk0iou8elTGahxK7Q8Wkg==
|
||||||
|
dependencies:
|
||||||
|
"@avocado/core" "2.0.0"
|
||||||
|
"@avocado/input" "2.0.0"
|
||||||
|
"@avocado/math" "2.0.0"
|
||||||
|
"@avocado/resource" "2.0.0"
|
||||||
|
"@avocado/traits" "^2.0.0"
|
||||||
|
"@latus/core" "^2.0.0"
|
||||||
|
"@latus/socket" "2.0.0"
|
||||||
|
"@pixi/constants" "^5.3.6"
|
||||||
|
"@pixi/core" "^5.3.6"
|
||||||
|
"@pixi/display" "^5.3.6"
|
||||||
|
"@pixi/filter-advanced-bloom" "^3.2.0"
|
||||||
|
"@pixi/filter-color-matrix" "^5.3.6"
|
||||||
|
"@pixi/graphics" "^5.3.6"
|
||||||
|
"@pixi/settings" "^5.3.6"
|
||||||
|
"@pixi/sprite" "^5.3.6"
|
||||||
|
"@pixi/text" "^5.3.6"
|
||||||
|
autoprefixer "^9.8.6"
|
||||||
|
debug "4.3.1"
|
||||||
|
image-size "^0.9.3"
|
||||||
|
|
||||||
|
"@avocado/input@2.0.0":
|
||||||
|
version "2.0.0"
|
||||||
|
resolved "http://npm.cha0sdev/@avocado%2finput/-/input-2.0.0.tgz#0a4cc8e933af72480a900c592a5025d117deea4f"
|
||||||
|
integrity sha512-aTbLXYM8JdFaD8CrMb4747BmRpxPucECoQcznlAW/ulndIRGhGBaSkDa6OwHa9oH7KfaL5Dcnu4EWaOAKkTcXA==
|
||||||
|
dependencies:
|
||||||
|
"@latus/core" "2.0.0"
|
||||||
|
"@latus/socket" "2.0.0"
|
||||||
|
autoprefixer "^9.8.6"
|
||||||
|
debug "4.3.1"
|
||||||
|
|
||||||
|
"@avocado/math@2.0.0":
|
||||||
|
version "2.0.0"
|
||||||
|
resolved "http://npm.cha0sdev/@avocado%2fmath/-/math-2.0.0.tgz#0c2c0b2665b6ab65696824f49382b294fd0cb30d"
|
||||||
|
integrity sha512-5Bfd85WFgXqnKtW7cEsLynHyx0uhgvmKKvOhC8fnf25nOXOx46RG5cw05PVUKAEYd6VBzbLUF4P8oo7n7hVfpQ==
|
||||||
|
dependencies:
|
||||||
|
"@avocado/core" "2.0.0"
|
||||||
|
"@latus/core" "^2.0.0"
|
||||||
|
autoprefixer "^9.8.6"
|
||||||
|
d3-quadtree "^2.0.0"
|
||||||
|
debug "4.3.1"
|
||||||
|
|
||||||
|
"@avocado/resource@2.0.0", "@avocado/resource@^2.0.0":
|
||||||
|
version "2.0.0"
|
||||||
|
resolved "http://npm.cha0sdev/@avocado%2fresource/-/resource-2.0.0.tgz#3ec04329d6e1357f67a956fca48062dcbb7107e1"
|
||||||
|
integrity sha512-V7PZsouL6rpAhTcSoyVIxZBiijFN++BDHfxwbDxiA1IaZ8ur2Af77IlsRoZhgihY2PDp3p1hypL24HJUJ2WQ9Q==
|
||||||
|
dependencies:
|
||||||
|
"@avocado/core" "2.0.0"
|
||||||
|
"@latus/core" "2.0.0"
|
||||||
|
autoprefixer "^9.8.6"
|
||||||
|
debug "4.3.1"
|
||||||
|
deepmerge "^4.2.2"
|
||||||
|
uuid "^8.3.2"
|
||||||
|
|
||||||
|
"@avocado/s13n@^2.0.0":
|
||||||
|
version "2.0.0"
|
||||||
|
resolved "http://npm.cha0sdev/@avocado%2fs13n/-/s13n-2.0.0.tgz#2849a8dd3f2ec91821ee18ffa51f6d6ccc3ac957"
|
||||||
|
integrity sha512-I26AuKZQj7g82RzqCYxtUPNX9ZedNWoPaNJnenJbMCDjznklNIFW0ZVpgbOb5Rqoa99YFDpafkEsaMKBGZTW6g==
|
||||||
|
dependencies:
|
||||||
|
"@avocado/resource" "^2.0.0"
|
||||||
|
"@latus/core" "2.0.0"
|
||||||
|
"@latus/socket" "2.0.0"
|
||||||
|
autoprefixer "^9.8.6"
|
||||||
|
debug "4.3.1"
|
||||||
|
msgpack-lite "^0.1.26"
|
||||||
|
|
||||||
|
"@avocado/traits@^2.0.0":
|
||||||
|
version "2.0.0"
|
||||||
|
resolved "http://npm.cha0sdev/@avocado%2ftraits/-/traits-2.0.0.tgz#f31b45d27491a5e502f0ad119672cc7b0b4a627b"
|
||||||
|
integrity sha512-zL7iGUeFb4odHDuk/2wK3O/ntGWw7OMYHGmJROT5sOTyjE4+G42AvUlKfaAeza109yH8gDL7IQxhWX7r1zG60g==
|
||||||
|
dependencies:
|
||||||
|
"@avocado/core" "^2.0.0"
|
||||||
|
"@avocado/resource" "^2.0.0"
|
||||||
|
"@avocado/s13n" "^2.0.0"
|
||||||
|
"@latus/core" "^2.0.0"
|
||||||
|
autoprefixer "^9.8.6"
|
||||||
|
debug "4.3.1"
|
||||||
|
|
||||||
"@babel/code-frame@^7.0.0", "@babel/code-frame@^7.10.4", "@babel/code-frame@^7.12.11":
|
"@babel/code-frame@^7.0.0", "@babel/code-frame@^7.10.4", "@babel/code-frame@^7.12.11":
|
||||||
version "7.12.11"
|
version "7.12.11"
|
||||||
resolved "http://npm.cha0sdev/@babel%2fcode-frame/-/code-frame-7.12.11.tgz#f4ad435aa263db935b8f10f2c552d23fb716a63f"
|
resolved "http://npm.cha0sdev/@babel%2fcode-frame/-/code-frame-7.12.11.tgz#f4ad435aa263db935b8f10f2c552d23fb716a63f"
|
||||||
|
@ -994,7 +1084,7 @@
|
||||||
reduce-reducers "^1.0.4"
|
reduce-reducers "^1.0.4"
|
||||||
redux "^4.0.5"
|
redux "^4.0.5"
|
||||||
|
|
||||||
"@latus/socket@^2.0.0":
|
"@latus/socket@2.0.0", "@latus/socket@^2.0.0":
|
||||||
version "2.0.0"
|
version "2.0.0"
|
||||||
resolved "http://npm.cha0sdev/@latus%2fsocket/-/socket-2.0.0.tgz#72f743b2cfbfb5e0d57a9dd0ab062691c7224fff"
|
resolved "http://npm.cha0sdev/@latus%2fsocket/-/socket-2.0.0.tgz#72f743b2cfbfb5e0d57a9dd0ab062691c7224fff"
|
||||||
integrity sha512-bjFJEhqv5XF2vSujelCcyHpMwFiQ2ZNbalpwrX4GhsfNUD8dDo1WdKd2WkqC7fWVZLhLulxodY0cqt2vYAIYKQ==
|
integrity sha512-bjFJEhqv5XF2vSujelCcyHpMwFiQ2ZNbalpwrX4GhsfNUD8dDo1WdKd2WkqC7fWVZLhLulxodY0cqt2vYAIYKQ==
|
||||||
|
@ -1144,6 +1234,121 @@
|
||||||
babel-merge "^3.0.0"
|
babel-merge "^3.0.0"
|
||||||
deepmerge "^1.5.2"
|
deepmerge "^1.5.2"
|
||||||
|
|
||||||
|
"@pixi/constants@5.3.7", "@pixi/constants@^5.3.6":
|
||||||
|
version "5.3.7"
|
||||||
|
resolved "http://npm.cha0sdev/@pixi%2fconstants/-/constants-5.3.7.tgz#a2e1789a98deb3713cfcb3eba3db84588bc9161e"
|
||||||
|
integrity sha512-MBcgIM/mSqonFezkCI9080IqNlc0wb8S9QJ5otBdseOWUQa/ua2jF7Jd1sCBGmi0IzS9/NOHFXzZVTdS7AC7Ow==
|
||||||
|
|
||||||
|
"@pixi/core@5.3.7", "@pixi/core@^5.3.6":
|
||||||
|
version "5.3.7"
|
||||||
|
resolved "http://npm.cha0sdev/@pixi%2fcore/-/core-5.3.7.tgz#a8d65ca17f0c4ef8c0c5a22d31b9e02a4ab73b93"
|
||||||
|
integrity sha512-WBhU2f5aJSVVaFP55FFBFKjKlRf5fYGxgA/U3kD4yD4Y3d3d6V3MIZv+o0VX+kBs1Eq7ePZqEv2smDrlzzMEjQ==
|
||||||
|
dependencies:
|
||||||
|
"@pixi/constants" "5.3.7"
|
||||||
|
"@pixi/math" "5.3.7"
|
||||||
|
"@pixi/runner" "5.3.7"
|
||||||
|
"@pixi/settings" "5.3.7"
|
||||||
|
"@pixi/ticker" "5.3.7"
|
||||||
|
"@pixi/utils" "5.3.7"
|
||||||
|
|
||||||
|
"@pixi/display@5.3.7", "@pixi/display@^5.3.6":
|
||||||
|
version "5.3.7"
|
||||||
|
resolved "http://npm.cha0sdev/@pixi%2fdisplay/-/display-5.3.7.tgz#b661d2ecfd2a67f213665a0698acd29e17eee8fe"
|
||||||
|
integrity sha512-ma1JyLe5vaEgmaOR+anvj5YOKqT9OEWnboIe7NVmwGF1CZ7JFnB12rsRulHUsSaFG9bP5xjvroAZjFg/WvyGLw==
|
||||||
|
dependencies:
|
||||||
|
"@pixi/math" "5.3.7"
|
||||||
|
"@pixi/settings" "5.3.7"
|
||||||
|
"@pixi/utils" "5.3.7"
|
||||||
|
|
||||||
|
"@pixi/filter-advanced-bloom@^3.2.0":
|
||||||
|
version "3.2.0"
|
||||||
|
resolved "http://npm.cha0sdev/@pixi%2ffilter-advanced-bloom/-/filter-advanced-bloom-3.2.0.tgz#c345adebf6605d814fb7ff8fda2292ed3d04ec01"
|
||||||
|
integrity sha512-t5WlbFGewxYQ8biRsgQCW/j7vNwQxYVDv3DpHJ7PghNdYlD2OKQ7b6bgcUzFQcsbJ2fm/8e+dSKI17zCK5idMg==
|
||||||
|
dependencies:
|
||||||
|
"@pixi/filter-kawase-blur" "3.2.0"
|
||||||
|
|
||||||
|
"@pixi/filter-color-matrix@^5.3.6":
|
||||||
|
version "5.3.7"
|
||||||
|
resolved "http://npm.cha0sdev/@pixi%2ffilter-color-matrix/-/filter-color-matrix-5.3.7.tgz#230cafe46bde36e25441b13f3ac5dd8e8fee4311"
|
||||||
|
integrity sha512-Z12cxoHx9uMh3CZ0PLVRzsaFHHF/CfU3J83KI9k+Bg/DFOh/J/5EToCd44jYJbMKp3nvXcO1EJyZ3wwC/IsyfQ==
|
||||||
|
dependencies:
|
||||||
|
"@pixi/core" "5.3.7"
|
||||||
|
|
||||||
|
"@pixi/filter-kawase-blur@3.2.0":
|
||||||
|
version "3.2.0"
|
||||||
|
resolved "http://npm.cha0sdev/@pixi%2ffilter-kawase-blur/-/filter-kawase-blur-3.2.0.tgz#f3fe6e3c17d191ae353959768c1170e85b2ad1dc"
|
||||||
|
integrity sha512-IO1UKn/XLvnV+ya4r1UOC9fTfXZjWvH9m6eQ/U+moBsQN5I5FihQfXCu586X4jb9VHNu3gFl7SUzirobhBfgtA==
|
||||||
|
|
||||||
|
"@pixi/graphics@^5.3.6":
|
||||||
|
version "5.3.7"
|
||||||
|
resolved "http://npm.cha0sdev/@pixi%2fgraphics/-/graphics-5.3.7.tgz#36ae80e2508e0a9c61ce454807d517d370d90a74"
|
||||||
|
integrity sha512-+6+bT/AC29a1Hw5XDxsH1UqBsXSqcna7wNTTrBQ02owotIJtyRc6w48f5qxzhxycumyVCR87IV5tAtdwX3xhag==
|
||||||
|
dependencies:
|
||||||
|
"@pixi/constants" "5.3.7"
|
||||||
|
"@pixi/core" "5.3.7"
|
||||||
|
"@pixi/display" "5.3.7"
|
||||||
|
"@pixi/math" "5.3.7"
|
||||||
|
"@pixi/sprite" "5.3.7"
|
||||||
|
"@pixi/utils" "5.3.7"
|
||||||
|
|
||||||
|
"@pixi/math@5.3.7":
|
||||||
|
version "5.3.7"
|
||||||
|
resolved "http://npm.cha0sdev/@pixi%2fmath/-/math-5.3.7.tgz#066e7ea149fd38db8d8a9584aac5f41d02b36bdd"
|
||||||
|
integrity sha512-WnjUwX7rkxR36F0xknpsNd9BsfQosV0BbyFE0Il88IURBM3Tu9X4tC7RGJDgWU+aXw23HgHu0j+MWJrCVCM2fA==
|
||||||
|
|
||||||
|
"@pixi/runner@5.3.7":
|
||||||
|
version "5.3.7"
|
||||||
|
resolved "http://npm.cha0sdev/@pixi%2frunner/-/runner-5.3.7.tgz#78ed2c92b392b8c099d2e4557dded7faa921446b"
|
||||||
|
integrity sha512-kt5apNb21HAvpBaDaPRs33k2O0VzrKe13w4we8iftCpXX8w68ErAY1lH68vmtDNrxnlHg4M9nRgEoMeiHlo2RA==
|
||||||
|
|
||||||
|
"@pixi/settings@5.3.7", "@pixi/settings@^5.3.6":
|
||||||
|
version "5.3.7"
|
||||||
|
resolved "http://npm.cha0sdev/@pixi%2fsettings/-/settings-5.3.7.tgz#b661883231bf2a1ff5260c214bd0c4b438759841"
|
||||||
|
integrity sha512-g6AoRSGWxU34gtKSQwX2AMQoLUv86L/5iIXRsqo+X4bfUSCenTci1X7ueVrSIbo39dxh6IOpriZF2Yk3TeHG5w==
|
||||||
|
dependencies:
|
||||||
|
ismobilejs "^1.1.0"
|
||||||
|
|
||||||
|
"@pixi/sprite@5.3.7", "@pixi/sprite@^5.3.6":
|
||||||
|
version "5.3.7"
|
||||||
|
resolved "http://npm.cha0sdev/@pixi%2fsprite/-/sprite-5.3.7.tgz#c6edf3d4a9928868696b62e35a60ded27d167058"
|
||||||
|
integrity sha512-Bjl+NOOvigEzUsm1cDr1KmBUpPSWO8pDXpUPTi+v2N75gwRfTycmj5f2TU0QmMW3Gc6sv0CB0AkL7dkMPwPb8g==
|
||||||
|
dependencies:
|
||||||
|
"@pixi/constants" "5.3.7"
|
||||||
|
"@pixi/core" "5.3.7"
|
||||||
|
"@pixi/display" "5.3.7"
|
||||||
|
"@pixi/math" "5.3.7"
|
||||||
|
"@pixi/settings" "5.3.7"
|
||||||
|
"@pixi/utils" "5.3.7"
|
||||||
|
|
||||||
|
"@pixi/text@^5.3.6":
|
||||||
|
version "5.3.7"
|
||||||
|
resolved "http://npm.cha0sdev/@pixi%2ftext/-/text-5.3.7.tgz#cb71b2576bdc1f66fb79977d281f9575dd06d3d5"
|
||||||
|
integrity sha512-WVAc31MDgHTvP0dJNWsvLVJhjeVGZ3NrLpHcH9iIAd6HVO5Z+i+fk4zvodD+Y7jWU0psx8ZD8xe1wy8ECfbCBA==
|
||||||
|
dependencies:
|
||||||
|
"@pixi/core" "5.3.7"
|
||||||
|
"@pixi/math" "5.3.7"
|
||||||
|
"@pixi/settings" "5.3.7"
|
||||||
|
"@pixi/sprite" "5.3.7"
|
||||||
|
"@pixi/utils" "5.3.7"
|
||||||
|
|
||||||
|
"@pixi/ticker@5.3.7":
|
||||||
|
version "5.3.7"
|
||||||
|
resolved "http://npm.cha0sdev/@pixi%2fticker/-/ticker-5.3.7.tgz#c331b270042d507fe18543ae435a9a857a8fd5ae"
|
||||||
|
integrity sha512-ZEXiJwPtuPeWa0QmRODF5qK0+ugZu/xeq7QxCvFOCc3NFVBeGms4g92HPucOju9R7jcODIoJxtICALsuwLAr9w==
|
||||||
|
dependencies:
|
||||||
|
"@pixi/settings" "5.3.7"
|
||||||
|
|
||||||
|
"@pixi/utils@5.3.7":
|
||||||
|
version "5.3.7"
|
||||||
|
resolved "http://npm.cha0sdev/@pixi%2futils/-/utils-5.3.7.tgz#55fe2a2fbf0fba842da5a602576ce68c498e7e16"
|
||||||
|
integrity sha512-f8zAeHHURxfwBr8MZiXEIwY2h9wbS6vN0ypvapGvKFOexZ1EInTs35FhEiRWzLEPLHyn1RgCdKzR2zl++E4tIw==
|
||||||
|
dependencies:
|
||||||
|
"@pixi/constants" "5.3.7"
|
||||||
|
"@pixi/settings" "5.3.7"
|
||||||
|
earcut "^2.1.5"
|
||||||
|
eventemitter3 "^3.1.0"
|
||||||
|
url "^0.11.0"
|
||||||
|
|
||||||
"@reduxjs/toolkit@^1.5.0":
|
"@reduxjs/toolkit@^1.5.0":
|
||||||
version "1.5.0"
|
version "1.5.0"
|
||||||
resolved "http://npm.cha0sdev/@reduxjs%2ftoolkit/-/toolkit-1.5.0.tgz#1025c1ccb224d1fc06d8d98a61f6717d57e6d477"
|
resolved "http://npm.cha0sdev/@reduxjs%2ftoolkit/-/toolkit-1.5.0.tgz#1025c1ccb224d1fc06d8d98a61f6717d57e6d477"
|
||||||
|
@ -2743,6 +2948,11 @@ cyclist@^1.0.1:
|
||||||
resolved "http://npm.cha0sdev/cyclist/-/cyclist-1.0.1.tgz#596e9698fd0c80e12038c2b82d6eb1b35b6224d9"
|
resolved "http://npm.cha0sdev/cyclist/-/cyclist-1.0.1.tgz#596e9698fd0c80e12038c2b82d6eb1b35b6224d9"
|
||||||
integrity sha1-WW6WmP0MgOEgOMK4LW6xs1tiJNk=
|
integrity sha1-WW6WmP0MgOEgOMK4LW6xs1tiJNk=
|
||||||
|
|
||||||
|
d3-quadtree@^2.0.0:
|
||||||
|
version "2.0.0"
|
||||||
|
resolved "http://npm.cha0sdev/d3-quadtree/-/d3-quadtree-2.0.0.tgz#edbad045cef88701f6fee3aee8e93fb332d30f9d"
|
||||||
|
integrity sha512-b0Ed2t1UUalJpc3qXzKi+cPGxeXRr4KU9YSlocN74aTzp6R/Ud43t79yLLqxHRWZfsvWXmbDWPpoENK1K539xw==
|
||||||
|
|
||||||
damerau-levenshtein@^1.0.6:
|
damerau-levenshtein@^1.0.6:
|
||||||
version "1.0.6"
|
version "1.0.6"
|
||||||
resolved "http://npm.cha0sdev/damerau-levenshtein/-/damerau-levenshtein-1.0.6.tgz#143c1641cb3d85c60c32329e26899adea8701791"
|
resolved "http://npm.cha0sdev/damerau-levenshtein/-/damerau-levenshtein-1.0.6.tgz#143c1641cb3d85c60c32329e26899adea8701791"
|
||||||
|
@ -3066,6 +3276,11 @@ duplexify@^3.4.2, duplexify@^3.6.0:
|
||||||
readable-stream "^2.0.0"
|
readable-stream "^2.0.0"
|
||||||
stream-shift "^1.0.0"
|
stream-shift "^1.0.0"
|
||||||
|
|
||||||
|
earcut@^2.1.5:
|
||||||
|
version "2.2.2"
|
||||||
|
resolved "http://npm.cha0sdev/earcut/-/earcut-2.2.2.tgz#41b0bc35f63e0fe80da7cddff28511e7e2e80d11"
|
||||||
|
integrity sha512-eZoZPPJcUHnfRZ0PjLvx2qBordSiO8ofC3vt+qACLM95u+4DovnbYNpQtJh0DNsWj8RnxrQytD4WA8gj5cRIaQ==
|
||||||
|
|
||||||
ecc-jsbn@~0.1.1:
|
ecc-jsbn@~0.1.1:
|
||||||
version "0.1.2"
|
version "0.1.2"
|
||||||
resolved "http://npm.cha0sdev/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz#3a83a904e54353287874c564b7549386849a98c9"
|
resolved "http://npm.cha0sdev/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz#3a83a904e54353287874c564b7549386849a98c9"
|
||||||
|
@ -3558,6 +3773,11 @@ event-lite@^0.1.1:
|
||||||
resolved "http://npm.cha0sdev/event-lite/-/event-lite-0.1.2.tgz#838a3e0fdddef8cc90f128006c8e55a4e4e4c11b"
|
resolved "http://npm.cha0sdev/event-lite/-/event-lite-0.1.2.tgz#838a3e0fdddef8cc90f128006c8e55a4e4e4c11b"
|
||||||
integrity sha512-HnSYx1BsJ87/p6swwzv+2v6B4X+uxUteoDfRxsAb1S1BePzQqOLevVmkdA15GHJVd9A9Ok6wygUR18Hu0YeV9g==
|
integrity sha512-HnSYx1BsJ87/p6swwzv+2v6B4X+uxUteoDfRxsAb1S1BePzQqOLevVmkdA15GHJVd9A9Ok6wygUR18Hu0YeV9g==
|
||||||
|
|
||||||
|
eventemitter3@^3.1.0:
|
||||||
|
version "3.1.2"
|
||||||
|
resolved "http://npm.cha0sdev/eventemitter3/-/eventemitter3-3.1.2.tgz#2d3d48f9c346698fce83a85d7d664e98535df6e7"
|
||||||
|
integrity sha512-tvtQIeLVHjDkJYnzf2dgVMxfuSGJeM/7UCG17TT4EumTfNtF+0nebF/4zWOIkCreAbtNqhGEboB6BWrwqNaw4Q==
|
||||||
|
|
||||||
eventemitter3@^4.0.0:
|
eventemitter3@^4.0.0:
|
||||||
version "4.0.7"
|
version "4.0.7"
|
||||||
resolved "http://npm.cha0sdev/eventemitter3/-/eventemitter3-4.0.7.tgz#2de9b68f6528d5644ef5c59526a1b4a07306169f"
|
resolved "http://npm.cha0sdev/eventemitter3/-/eventemitter3-4.0.7.tgz#2de9b68f6528d5644ef5c59526a1b4a07306169f"
|
||||||
|
@ -4522,6 +4742,13 @@ ignore@^4.0.6:
|
||||||
resolved "http://npm.cha0sdev/ignore/-/ignore-4.0.6.tgz#750e3db5862087b4737ebac8207ffd1ef27b25fc"
|
resolved "http://npm.cha0sdev/ignore/-/ignore-4.0.6.tgz#750e3db5862087b4737ebac8207ffd1ef27b25fc"
|
||||||
integrity sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==
|
integrity sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==
|
||||||
|
|
||||||
|
image-size@^0.9.3:
|
||||||
|
version "0.9.3"
|
||||||
|
resolved "http://npm.cha0sdev/image-size/-/image-size-0.9.3.tgz#f7efce6b0a1649b44b9bc43b9d9a5acf272264b6"
|
||||||
|
integrity sha512-5SakFa79uhUVSjKeQE30GVzzLJ0QNzB53+I+/VD1vIesD6GP6uatWIlgU0uisFNLt1u0d6kBydp7yfk+lLJhLQ==
|
||||||
|
dependencies:
|
||||||
|
queue "6.0.1"
|
||||||
|
|
||||||
immer@^8.0.0:
|
immer@^8.0.0:
|
||||||
version "8.0.1"
|
version "8.0.1"
|
||||||
resolved "http://npm.cha0sdev/immer/-/immer-8.0.1.tgz#9c73db683e2b3975c424fb0572af5889877ae656"
|
resolved "http://npm.cha0sdev/immer/-/immer-8.0.1.tgz#9c73db683e2b3975c424fb0572af5889877ae656"
|
||||||
|
@ -4931,6 +5158,11 @@ isexe@^2.0.0:
|
||||||
resolved "http://npm.cha0sdev/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10"
|
resolved "http://npm.cha0sdev/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10"
|
||||||
integrity sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=
|
integrity sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=
|
||||||
|
|
||||||
|
ismobilejs@^1.1.0:
|
||||||
|
version "1.1.1"
|
||||||
|
resolved "http://npm.cha0sdev/ismobilejs/-/ismobilejs-1.1.1.tgz#c56ca0ae8e52b24ca0f22ba5ef3215a2ddbbaa0e"
|
||||||
|
integrity sha512-VaFW53yt8QO61k2WJui0dHf4SlL8lxBofUuUmwBo0ljPk0Drz2TiuDW4jo3wDcv41qy/SxrJ+VAzJ/qYqsmzRw==
|
||||||
|
|
||||||
isobject@^2.0.0:
|
isobject@^2.0.0:
|
||||||
version "2.1.0"
|
version "2.1.0"
|
||||||
resolved "http://npm.cha0sdev/isobject/-/isobject-2.1.0.tgz#f065561096a3f1da2ef46272f815c840d87e0c89"
|
resolved "http://npm.cha0sdev/isobject/-/isobject-2.1.0.tgz#f065561096a3f1da2ef46272f815c840d87e0c89"
|
||||||
|
@ -6695,6 +6927,13 @@ querystringify@^2.1.1:
|
||||||
resolved "http://npm.cha0sdev/querystringify/-/querystringify-2.2.0.tgz#3345941b4153cb9d082d8eee4cda2016a9aef7f6"
|
resolved "http://npm.cha0sdev/querystringify/-/querystringify-2.2.0.tgz#3345941b4153cb9d082d8eee4cda2016a9aef7f6"
|
||||||
integrity sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ==
|
integrity sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ==
|
||||||
|
|
||||||
|
queue@6.0.1:
|
||||||
|
version "6.0.1"
|
||||||
|
resolved "http://npm.cha0sdev/queue/-/queue-6.0.1.tgz#abd5a5b0376912f070a25729e0b6a7d565683791"
|
||||||
|
integrity sha512-AJBQabRCCNr9ANq8v77RJEv73DPbn55cdTb+Giq4X0AVnNVZvMHlYp7XlQiN+1npCZj1DuSmaA2hYVUUDgxFDg==
|
||||||
|
dependencies:
|
||||||
|
inherits "~2.0.3"
|
||||||
|
|
||||||
randombytes@^2.0.0, randombytes@^2.0.1, randombytes@^2.0.5, randombytes@^2.1.0:
|
randombytes@^2.0.0, randombytes@^2.0.1, randombytes@^2.0.5, randombytes@^2.1.0:
|
||||||
version "2.1.0"
|
version "2.1.0"
|
||||||
resolved "http://npm.cha0sdev/randombytes/-/randombytes-2.1.0.tgz#df6f84372f0270dc65cdf6291349ab7a473d4f2a"
|
resolved "http://npm.cha0sdev/randombytes/-/randombytes-2.1.0.tgz#df6f84372f0270dc65cdf6291349ab7a473d4f2a"
|
||||||
|
@ -8335,7 +8574,7 @@ uuid@^3.3.2, uuid@^3.4.0:
|
||||||
resolved "http://npm.cha0sdev/uuid/-/uuid-3.4.0.tgz#b23e4358afa8a202fe7a100af1f5f883f02007ee"
|
resolved "http://npm.cha0sdev/uuid/-/uuid-3.4.0.tgz#b23e4358afa8a202fe7a100af1f5f883f02007ee"
|
||||||
integrity sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==
|
integrity sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==
|
||||||
|
|
||||||
uuid@^8.1.0:
|
uuid@^8.1.0, uuid@^8.3.2:
|
||||||
version "8.3.2"
|
version "8.3.2"
|
||||||
resolved "http://npm.cha0sdev/uuid/-/uuid-8.3.2.tgz#80d5b5ced271bb9af6c445f21a1a04c606cefbe2"
|
resolved "http://npm.cha0sdev/uuid/-/uuid-8.3.2.tgz#80d5b5ced271bb9af6c445f21a1a04c606cefbe2"
|
||||||
integrity sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==
|
integrity sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
"@avocado/traits": "^2.0.0",
|
"@avocado/traits": "^2.0.0",
|
||||||
"@latus/core": "^2.0.0",
|
"@latus/core": "^2.0.0",
|
||||||
"@latus/react": "^2.0.0",
|
"@latus/react": "^2.0.0",
|
||||||
|
"@persea/core": "^1.0.0",
|
||||||
"debug": "4.3.1",
|
"debug": "4.3.1",
|
||||||
"react-tabs": "^3.1.2"
|
"react-tabs": "^3.1.2"
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,46 +1,40 @@
|
||||||
import './index.scss';
|
import './index.scss';
|
||||||
|
|
||||||
import {Renderer} from '@avocado/graphics';
|
|
||||||
import {Rectangle, Vector} from '@avocado/math';
|
import {Rectangle, Vector} from '@avocado/math';
|
||||||
import {PropTypes, React} from '@latus/react';
|
import {PropTypes, React} from '@latus/react';
|
||||||
|
import {Stage} from '@persea/core';
|
||||||
|
|
||||||
const {
|
const {
|
||||||
useEffect,
|
useEffect,
|
||||||
useRef,
|
useState,
|
||||||
} = React;
|
} = React;
|
||||||
|
|
||||||
const Stage = ({entity}) => {
|
const EntityStage = ({entity}) => {
|
||||||
const ref = useRef();
|
const [size, setSize] = useState([0, 0]);
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!ref.current) {
|
if (!entity) {
|
||||||
return undefined;
|
return;
|
||||||
}
|
}
|
||||||
const container = ref.current;
|
|
||||||
entity.tick(0);
|
entity.tick(0);
|
||||||
const size = Vector.max(Rectangle.size(entity.visibleAabb), [64, 64]);
|
const size = Vector.max(Rectangle.size(entity.visibleAabb), [64, 64]);
|
||||||
entity.setPosition(Vector.scale(size, 4));
|
setSize(size);
|
||||||
const renderer = new Renderer(Vector.scale(size, 8));
|
entity.setPosition(Vector.scale(size, 0.5));
|
||||||
ref.current.appendChild(renderer.element);
|
}, [entity]);
|
||||||
const handle = setInterval(() => {
|
|
||||||
entity.tick(0.03);
|
|
||||||
entity.renderTick();
|
|
||||||
renderer.render(entity.container);
|
|
||||||
}, 33.33);
|
|
||||||
return () => {
|
|
||||||
if (renderer) {
|
|
||||||
container.removeChild(renderer.element);
|
|
||||||
}
|
|
||||||
if (handle) {
|
|
||||||
clearInterval(handle);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}, [entity, ref]);
|
|
||||||
return (
|
return (
|
||||||
<div className="entity-stage" ref={ref} />
|
<div className="entity-stage">
|
||||||
|
<Stage
|
||||||
|
renderable={entity.container}
|
||||||
|
size={size}
|
||||||
|
ticker={(elapsed) => {
|
||||||
|
entity.tick(elapsed);
|
||||||
|
entity.renderTick();
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
Stage.propTypes = {
|
EntityStage.propTypes = {
|
||||||
entity: PropTypes.shape({
|
entity: PropTypes.shape({
|
||||||
container: PropTypes.shape({}),
|
container: PropTypes.shape({}),
|
||||||
renderTick: PropTypes.func,
|
renderTick: PropTypes.func,
|
||||||
|
@ -50,4 +44,4 @@ Stage.propTypes = {
|
||||||
}).isRequired,
|
}).isRequired,
|
||||||
};
|
};
|
||||||
|
|
||||||
export default Stage;
|
export default EntityStage;
|
||||||
|
|
|
@ -1210,6 +1210,16 @@
|
||||||
babel-merge "^3.0.0"
|
babel-merge "^3.0.0"
|
||||||
deepmerge "^1.5.2"
|
deepmerge "^1.5.2"
|
||||||
|
|
||||||
|
"@persea/core@^1.0.0":
|
||||||
|
version "1.0.0"
|
||||||
|
resolved "http://npm.cha0sdev/@persea%2fcore/-/core-1.0.0.tgz#0d6f851924081891a85b21d5f30a880ae25c0a6d"
|
||||||
|
integrity sha512-WuWn3DnnfopbmDB81yb+GRrDlpJW7Rn1UXJaVGbCa4W0Z4EwkNCe13tZh0tR+ZKDKfhmIq1gzUsy5YRH7bCO/A==
|
||||||
|
dependencies:
|
||||||
|
"@latus/core" "^2.0.0"
|
||||||
|
debug "4.3.1"
|
||||||
|
glob "^7.1.6"
|
||||||
|
natsort "^2.0.2"
|
||||||
|
|
||||||
"@pixi/constants@5.3.7", "@pixi/constants@^5.3.6":
|
"@pixi/constants@5.3.7", "@pixi/constants@^5.3.6":
|
||||||
version "5.3.7"
|
version "5.3.7"
|
||||||
resolved "http://npm.cha0sdev/@pixi%2fconstants/-/constants-5.3.7.tgz#a2e1789a98deb3713cfcb3eba3db84588bc9161e"
|
resolved "http://npm.cha0sdev/@pixi%2fconstants/-/constants-5.3.7.tgz#a2e1789a98deb3713cfcb3eba3db84588bc9161e"
|
||||||
|
@ -4243,7 +4253,7 @@ glob-parent@^5.0.0, glob-parent@~5.1.0:
|
||||||
dependencies:
|
dependencies:
|
||||||
is-glob "^4.0.1"
|
is-glob "^4.0.1"
|
||||||
|
|
||||||
glob@7.1.6, glob@^7.0.0, glob@^7.0.3, glob@^7.1.2, glob@^7.1.3, glob@^7.1.4, glob@~7.1.1:
|
glob@7.1.6, glob@^7.0.0, glob@^7.0.3, glob@^7.1.2, glob@^7.1.3, glob@^7.1.4, glob@^7.1.6, glob@~7.1.1:
|
||||||
version "7.1.6"
|
version "7.1.6"
|
||||||
resolved "http://npm.cha0sdev/glob/-/glob-7.1.6.tgz#141f33b81a7c2492e125594307480c46679278a6"
|
resolved "http://npm.cha0sdev/glob/-/glob-7.1.6.tgz#141f33b81a7c2492e125594307480c46679278a6"
|
||||||
integrity sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==
|
integrity sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==
|
||||||
|
@ -5817,6 +5827,11 @@ nanomatch@^1.2.9:
|
||||||
snapdragon "^0.8.1"
|
snapdragon "^0.8.1"
|
||||||
to-regex "^3.0.1"
|
to-regex "^3.0.1"
|
||||||
|
|
||||||
|
natsort@^2.0.2:
|
||||||
|
version "2.0.2"
|
||||||
|
resolved "http://npm.cha0sdev/natsort/-/natsort-2.0.2.tgz#3358b7af00f155c8ce181289ede79e18d81e6c52"
|
||||||
|
integrity sha512-McY0uA4rDU7GkkoQ1oU8bH9P13onCIrPWxpOjlt792ccFZFkenFm29AHyRCdhbbbfhPfTsjTDagBqjpphD3R7Q==
|
||||||
|
|
||||||
natural-compare@^1.4.0:
|
natural-compare@^1.4.0:
|
||||||
version "1.4.0"
|
version "1.4.0"
|
||||||
resolved "http://npm.cha0sdev/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7"
|
resolved "http://npm.cha0sdev/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user