Skip to content

Commit

Permalink
fix webpack bundle issue
Browse files Browse the repository at this point in the history
  • Loading branch information
cyan33 committed Dec 9, 2017
1 parent 614b88a commit 62e80a5
Show file tree
Hide file tree
Showing 21 changed files with 1,048 additions and 66 deletions.
1,080 changes: 1,030 additions & 50 deletions dist/zion.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions src/canvas.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,12 @@ function insertText(context, options = { }) {
context.fillText(text, x, y);
}

module.exports = () => {
module.exports = () => ({
clearCanvas,
coordinateConversion,
getBoundaries,
generateRandomPosition,
createImageCache,
drawRotate,
insertText;
};
insertText
});
2 changes: 1 addition & 1 deletion src/components/AI/AI.js → src/components/AI/AI.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const Sprite = require('../Sprite');
const Vector = require('./Vector');
const Path = require('./Path');
const { getRandomInt } = require('../utils')();
const { getRandomInt } = require('../../utils')();
/** target proximity to halt path following */
const TARGET_PROX = 5;
const vector = Vector();
Expand Down
2 changes: 1 addition & 1 deletion src/components/AI/AStar.js → src/components/AI/AStar.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const VertexRecord = require('./VertexRecord');
const { getDistance } = require('../operations');
const { getDistance } = require('../../utils')();

/** the type of heuristic to use */
const HEUR_TYPE = 0;
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const Vertex = require('./Vertex');
const {calculateCenter, getDistance} = require('../operations');
const { calculateCenter, getDistance } = require('../../utils')();

class GraphGenerator {
constructor(){
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { getDistance } = require('../operations');
const { getDistance } = require('../../utils')();

// todo: should be a class
function Vector() {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions src/components/Obstacle.js → src/components/Obstacle.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* @author jegood
*/
const Sprite = require('./Sprite');
const { getDistance, calculateCenter } = require('./operations');
const { getDistance, calculateCenter } = require('../utils')();
const NUM_SECTIONS = 9;

class Obstacle extends Sprite {
Expand Down Expand Up @@ -52,4 +52,4 @@ class Obstacle extends Sprite {
}
}

export default Obstacle;
module.exports = Obstacle;
2 changes: 1 addition & 1 deletion src/components/Particle.js → src/components/Particle.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* @author jegood
*/
const Obstacle = require('./Obstacle');
const { getRandomNumber } = require('../operations');
const { getRandomNumber } = require('../utils')();
const MAX_CIRCLE = 360;

class Particle extends Obstacle {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* @author jegood
*/
const _ = require('../operations')();
const _ = require('../utils')();
const Particle = require('./Particle');
/**
* Class for handling particle systems. For now, simply allows management
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 3 additions & 1 deletion src/dnd.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const { getBoundaries } = require('./canvas')();
* drag and drop in canvas is much different than in DOM, because the canvas comes
* as a whole, so these functions may seem to be hacky, or dirty.
*/
export default function createDnD() {
function createDnD() {
const getDraggingItemIndex = (items, x, y) => {
for (let i = 0; i < items.length; i++) {
let currItem = items[i];
Expand Down Expand Up @@ -60,3 +60,5 @@ export default function createDnD() {
getDraggingItemIndex,
};
}

module.exports = createDnD;
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* @author Chang
*/
const createComponents = require('./components/index');
const createComponents = require('./components');
// const createIO = require('./network');
const createCanvasUtils = require('./canvas');
const createAudioManager = require('./audioManager');
Expand Down
6 changes: 3 additions & 3 deletions src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ function calculateCenter(x, y, width, height) {
return {x: x + (0.5 * width), y: y + (0.5 * height)};
}

module.exports = () => {
module.exports = () => ({
removeMultiElementFromArray,
getRandomInt,
getDistance,
calculateCenter;
};
calculateCenter
});

0 comments on commit 62e80a5

Please sign in to comment.