summaryrefslogtreecommitdiff
path: root/test/mocks/mx.js
blob: 69c4b3ae261488a4704e8055ad95df10bebaca27 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// Non-DOM-dependent stub MX library
// Used for testing code that builds MX elements, without a DOM dependency

var _ = require("lodash");

var MX = module.exports = {}

MX.Object3D = function (klass) {
  this.klass = klass
	this.width = this.height = this.scaleX = this.scaleY = this.scaleZ = 1
	this.rotationX = this.rotationY = this.rotationZ = 0
	this.z = this.y = this.x = 0
	this.side = 0
	this.type = "Face"
	this.el = { style: {} }
	this.rect = null
}
MX.Object3D.prototype.report = function(){
  var data = _.pick(this, ['x','y','z','width','height','rotationX','rotationY'])
  return data
}

MX.Scene = {
  els: [],
  add: function (el) {
    MX.Scene.els.push(el)
  },
  remove: function (el) {
    var index = MX.Scene.els.indexOf(el)
    MX.Scene.els.splice(index, 1)
  }
}