Skip to content

Commit

Permalink
resolve the bug regarding non-covelant-binding
Browse files Browse the repository at this point in the history
  • Loading branch information
asadeg02 committed Dec 6, 2018
1 parent b5c9887 commit d629fa9
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
11 changes: 8 additions & 3 deletions lib/interactions/non-covelant-binding.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,14 @@ function render(design, interaction, segments, interactions) {
let productOffset = 0;
let width = 0;
for (let i in interaction.participants) {


if (!interaction.participants[i].segment) {
console.log(interaction.participants[i], "partcipant")
console.log(interaction, "interaction")
}
//clear all the previous rolles attached to participant segment
interaction.participants[i].segment.role = null;


if (interaction.participants[i].role === "reactant") {
reactantNumber++;
Expand All @@ -36,15 +41,15 @@ function render(design, interaction, segments, interactions) {
var segment = Segment.render(design, interaction.participants[i].segment, interactions);

if (i == 0) {
productOffset = interaction.participants.segmentWidth;
productOffset = interaction.segmentWidth;

}

if (interaction.participants[i].role === "product") {

//segment.dx(110);
segment.dx(productOffset);

}

else if (interaction.participants[i].segment.role === "reactant2") {
Expand Down
3 changes: 1 addition & 2 deletions lib/interactions/stimulation.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ function render(design, interaction, segments, interactions) {
//update participant offset
design.geom.participantOffset = Helper.find_participant_offset(interaction.participants[i], interaction.displayId, "simulation");
var segment = Segment.render(design, interaction.participants[i].segment, interactions);
console.log(sgment.bbox().height)
nonDNAVerticalOffset = segment.bbox().height + 30;
nonDNAshorizontalOffset = (segment.bbox().width)/2;
}
Expand All @@ -62,7 +61,7 @@ function render(design, interaction, segments, interactions) {
if (isCircuit ) {
//segment.dx( (design.geom.participantOffset -1) * (design.geom.defaultGlyphSize.x + design.geom.glyphPadding) + design.geom.glyphPadding + design.geom.defaultGlyphSize.x/2)
segment.dx(nonDNAshorizontalOffset - segment.bbox().width);
segment.dy(-nonDNAVerticalOffset - segment.bbox().height);
segment.dy(-nonDNAVerticalOffset);
}
else if (!isCircuit) {
segment.dx(0)
Expand Down
3 changes: 2 additions & 1 deletion lib/segment.js
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,8 @@ function renderSegment(design, segment, interactions,) {
var arrowGlyph = arrowProps.glyph;
arrowGlyph.transform({ matrix: Matrix.toSVGString(arrowTransform) });
group.add(arrowGlyph);
interaction.participants.segmentWidth = group.bbox().width
//interaction.participants.segmentWidth = group.bbox().width
interaction.segmentWidth = group.bbox().width
}

//if glyph is the first reactant in a non-covelant-binding-reaction modify direction of arrow
Expand Down

0 comments on commit d629fa9

Please sign in to comment.