Skip to content

Commit

Permalink
ci: build gh-pages (#159)
Browse files Browse the repository at this point in the history
* build gh-pages

* fix test

* fix permutation test
  • Loading branch information
straker committed Jun 30, 2020
1 parent 219067c commit 65b8549
Show file tree
Hide file tree
Showing 5 changed files with 302 additions and 175 deletions.
14 changes: 12 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,15 @@ dist: trusty
sudo: required
addons:
chrome: stable
script: npm test && npm run test:permutations
after_script: "cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js"
script: npm run build && npm test && npm run test:permutations
after_script: "cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js"

# Deploy github pages
deploy:
provider: pages
skip_cleanup: true
github_token: $GITHUB_TOKEN
keep_history: true
local_dir: docs
# on:
# branch: main
52 changes: 44 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

39 changes: 37 additions & 2 deletions src/gameObject.js
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,34 @@ class GameObject {
set viewY(value) {
return;
}

// @ifdef GAMEOBJECT_GROUP
get sx() {
return this._sx;
}

get sy() {
return this._sy;
}

set sx(value) {
let diff = value - this._sx;
this.children.map(child => {
child.sx += diff;
});

this._sx = value;
}

set sy(value) {
let diff = value - this._sy;
this.children.map(child => {
child.sy += diff;
});

this._sy = value;
}
// @endif
// @endif

// @ifdef GAMEOBJECT_TTL
Expand Down Expand Up @@ -401,7 +429,7 @@ class GameObject {
* @function addChild
*
* @param {GameObject} child - Object to add as a child.
* @param {Object} options - Options for adding the child.
* @param {Object} [options] - Options for adding the child.
* @param {Boolean} [options.absolute=false] - If set the true, the x/y position of the child is treated as an absolute position in the world rather than being relative to the x/y position of the parent.
*
* @example
Expand Down Expand Up @@ -449,7 +477,7 @@ class GameObject {
child.y = absolute ? child.y : this.y + child.y;

// @ifdef GAMEOBJECT_ROTATION
if (child.rotation) {
if ('rotation' in child) {
child.rotation = absolute ? child.rotation : this.rotation + child.rotation;
}
// @endif
Expand All @@ -459,6 +487,13 @@ class GameObject {
child.setScale(this.scale.x, this.scale.y);
}
// @endif

// @ifdef GAMEOBJECT_CAMERA
if ('sx' in child) {
child.sx = absolute ? child.sx : this.sx + child.sx;
child.sy = absolute ? child.sy : this.sy + child.sy;
}
// @endif
}

/**
Expand Down

0 comments on commit 65b8549

Please sign in to comment.