Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/124 #125

Merged
merged 10 commits into from
Jan 10, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 36 additions & 31 deletions js/components/widgets/stackViewer/StackViewerComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ define(function (require) {
while (GEPPETTO.SceneController.getSelection()[0] != undefined) {
GEPPETTO.SceneController.getSelection()[0].deselect();
}
$.each(this.state.stack, function (i, item) {
$.each([this.state.stack[0]], function (i, item) {
(function (i, that, shift) {
var shift = GEPPETTO.isKeyPressed("shift");
var image = that.state.serverUrl.toString() + '?wlz=' + item + '&sel=0,255,255,255&mod=zeta&fxp=' + that.props.fxp.join(',') + '&scl=' + that.props.scl.toFixed(1) + '&dst=' + Number(that.state.dst).toFixed(1) + '&pit=' + Number(that.state.pit).toFixed(0) + '&yaw=' + Number(that.state.yaw).toFixed(0) + '&rol=' + Number(that.state.rol).toFixed(0);
Expand Down Expand Up @@ -429,7 +429,7 @@ define(function (require) {
var i, j, result;
var that = this;
var callX = that.state.posX.toFixed(0), callY = that.state.posY.toFixed(0);
$.each(this.state.stack, function (i, item) {
$.each([this.state.stack[0]], function (i, item) {
(function (i, that, shift) {
if (i == 0) {
that.state.loadingLabels = true;
Expand All @@ -443,39 +443,33 @@ define(function (require) {
success: function (data) {
result = data.trim().split(':')[1].trim().split(' ');
if (result !== '') {
var currentPosition = that.renderer.plugins.interaction.mouse.getLocalPosition(that.stack);
if (callX == currentPosition.x.toFixed(0) && callY == currentPosition.y.toFixed(0)) {
for (j in result) {
if (result[j].trim() !== '') {
var index = Number(result[j]);
if (i !== 0 || index !== 0) { // don't select template
if (index == 0) {
if (!shift) {
that.state.objects.push(that.state.label[i]);
}
} else {
if (typeof that.props.templateDomainIds !== 'undefined' && typeof that.props.templateDomainNames !== 'undefined' && typeof that.props.templateDomainIds[index] !== 'undefined' && typeof that.props.templateDomainNames[index] !== 'undefined' && that.props.templateDomainNames[index] !== null) {
that.state.objects.push(that.props.templateDomainNames[index]);
break;
}
for (j in result) {
if (result[j].trim() !== '') {
var index = Number(result[j]);
if (i !== 0 || index !== 0) { // don't select template
if (index == 0) {
if (!shift) {
that.state.objects.push(that.state.label[i]);
}
} else {
if (typeof that.props.templateDomainIds !== 'undefined' && typeof that.props.templateDomainNames !== 'undefined' && typeof that.props.templateDomainIds[index] !== 'undefined' && typeof that.props.templateDomainNames[index] !== 'undefined' && that.props.templateDomainNames[index] !== null) {
that.state.objects.push(that.props.templateDomainNames[index]);
break;
}
}
}
}
var list = $.unique(that.state.objects).sort();
var objects = '';
if (shift) {
objects = 'Click to add: ';
}
for (j in list) {
objects = objects + list[j] + '\n';
}
if (objects !== '') {
that.setStatusText(objects);
}
} else if (i == 0) {
that.state.loadingLabels = false;
that.onHoverEvent();
}
var list = $.unique(that.state.objects).sort();
var objects = '';
if (shift) {
objects = 'Click to add: ';
}
for (j in list) {
objects = objects + list[j] + '\n';
}
if (objects !== '' && i == 0) {
that.setHoverText(callX,callY,list[0]);
}
}
// update slice view
Expand All @@ -492,6 +486,7 @@ define(function (require) {
});
})(i, that);
});
that.state.loadingLabels = false;
}
},

Expand Down Expand Up @@ -896,6 +891,16 @@ define(function (require) {
},

setStatusText: function (text) {
this.state.buffer[-1].x = (-this.stage.position.x + 35);
this.state.buffer[-1].y = (-this.stage.position.y + 8);
this.state.buffer[-1].text = text;
this.state.text = text;
this.state.txtUpdated = Date.now();
},

setHoverText: function (x,y,text) {
this.state.buffer[-1].x = -this.stage.position.x + -10 + (this.stack.parent.position.x + (this.stack.position.x * this.disp.scale.x)) + (Number(x) * this.disp.scale.x);
this.state.buffer[-1].y = -this.stage.position.y + 15 + (this.stack.parent.position.y + (this.stack.position.y * this.disp.scale.y)) + (Number(y) * this.disp.scale.y);
this.state.buffer[-1].text = text;
this.state.text = text;
this.state.txtUpdated = Date.now();
Expand Down