syncing master
This commit is contained in:
@@ -122,7 +122,10 @@
|
||||
this.isDualTilt = isDualTilt;
|
||||
this.subarrayDisplay = subarrayDisplay;
|
||||
this.buildings = buildings;
|
||||
|
||||
// Default options
|
||||
this.scale = 10;
|
||||
this.panels = [];
|
||||
}
|
||||
|
||||
_createClass(ArrayVisualization, [{
|
||||
@@ -137,7 +140,7 @@
|
||||
this.stage.mouseMoveOutside = true;
|
||||
this.adjustScale(this.buildings);
|
||||
|
||||
this.drawArray(this.container, this.panelData, this.scale);
|
||||
this.drawArray(this.container, this.panelData);
|
||||
this.container.x = 0;
|
||||
this.container.y = 0;
|
||||
this.stage.addChild(this.container);
|
||||
@@ -200,13 +203,13 @@
|
||||
}
|
||||
}, {
|
||||
key: 'drawBuildings',
|
||||
value: function drawBuildings(buildings, scale) {
|
||||
if (!buildings) {
|
||||
value: function drawBuildings(buildings) {
|
||||
if (!buildings || buildings.length === 0) {
|
||||
console.log("No Buildings!");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!scale) {
|
||||
if (!this.scale) {
|
||||
console.log("No Scale - don't know how big the buildings should be!");
|
||||
return;
|
||||
}
|
||||
@@ -223,14 +226,14 @@
|
||||
|
||||
line.graphics.beginStroke(color);
|
||||
|
||||
line.graphics.moveTo(firstPoint.x * scale, firstPoint.y * scale);
|
||||
line.graphics.moveTo(firstPoint.x * this.scale, firstPoint.y * this.scale);
|
||||
|
||||
for (var j = 1; j < building.length; j++) {
|
||||
nextPoint = building[j];
|
||||
line.graphics.lineTo(nextPoint.x * scale, nextPoint.y * scale);
|
||||
line.graphics.moveTo(nextPoint.x * scale, nextPoint.y * scale);
|
||||
line.graphics.lineTo(nextPoint.x * this.scale, nextPoint.y * this.scale);
|
||||
line.graphics.moveTo(nextPoint.x * this.scale, nextPoint.y * this.scale);
|
||||
}
|
||||
line.graphics.lineTo(firstPoint.x * scale, firstPoint.y * scale);
|
||||
line.graphics.lineTo(firstPoint.x * this.scale, firstPoint.y * this.scale);
|
||||
line.graphics.endStroke();
|
||||
}
|
||||
|
||||
@@ -245,7 +248,7 @@
|
||||
this.container.removeChild(this.panels[i]);
|
||||
}
|
||||
|
||||
this.drawArray(this.container, this.panelData, this.scale);
|
||||
this.drawArray(this.container, this.panelData);
|
||||
|
||||
var selectedPanel = this.selectedPanel;
|
||||
this.selectedPanel = undefined;
|
||||
@@ -261,19 +264,15 @@
|
||||
value: function drawArray(container, panels) {
|
||||
var _this2 = this;
|
||||
|
||||
this.panels = [];
|
||||
var treatCoordinatesAsCenterpoints = this.buildings && this.buildings.length > 0;
|
||||
|
||||
var _loop = function _loop(i) {
|
||||
var panel = panels[i];
|
||||
|
||||
var box = new _panel.Panel(panel, _this2.isDualTilt, _this2.scale, treatCoordinatesAsCenterpoints);
|
||||
var box = new _panel.Panel(panels[i], _this2.isDualTilt, _this2.scale, treatCoordinatesAsCenterpoints);
|
||||
container.addChild(box);
|
||||
_this2.panels.push(box);
|
||||
|
||||
var self = _this2;
|
||||
box.on("click", function () {
|
||||
self.selectPanel(i);
|
||||
_this2.selectPanel(i);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user