From 2f62d573db121b4d0fbb887c4fd6a9cd0bb67298 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Fri, 4 May 2018 19:40:57 +0200 Subject: [PATCH] Bubbles Apperar and Dissapear but are not removed from the Floating Layer --- .vs/AAWeb/v15/.suo | Bin 72704 -> 72704 bytes FloatingSpace/Bubble.js | 18 +++++++++++++++--- FloatingSpace/BubbleSets.js | 10 +++++----- FloatingSpace/FloatingLayer.js | 7 ++++--- 4 files changed, 24 insertions(+), 11 deletions(-) diff --git a/.vs/AAWeb/v15/.suo b/.vs/AAWeb/v15/.suo index a16cd9529b0cd043963f7690273a22b50ee86cd6..a4d0992387c7c427af3cc901ec96bec99a668229 100644 GIT binary patch delta 534 zcmZqJ!P2mUWkU`V>xCoRWzKCbWctm_S|ImR7RY2{S7CJDT&eZn9zY(SNvp$9=^#A+YK3)KzU-58+I8?wryWLdBZNgMI9`Y6)&_gE(J+$cIc5} zWK5XM80I$l#aXG%iGA~#CogQ4oxFa5z-HY8ml-!r$zo+hF?F-Rg%8Y=-_2!TRKhg* z;4XiV(#g69G&c8LD`K4dZXx@kGLFgY4{mWK09_;k#4cc)fR1vXT)(<(Q61A{#~!)O zs*fHqFWSU1dEs7}$stG9Y(D?2m{IUPP&o|z0x}FXJMJiA6my1&F$f)q2eOTT*kwA< z{W>IheF~DFCpS(qp4>mfa&qyjJ8Tf+H~a0EVL|b$#-<}oJexT$e24h=3J(9?z~kS> c$qo;=CMP`P1bSGOjbsnT!`!&p$0Gh(ej{pDw delta 532 zcmZqJ!P2mUWkU`VYeV?7b0;{qR@~q>nRlJw zWY*r_lM8xfC;Kn3m>fDOkTGF0W0>3I7iXn5C-%)}p1g2}?Bx6n+>_t0)0zBh(nQ83 zK>fKujU1EZ+YKf&ZYbR}C5x32#YPq$1{V~8%?oBFFi%cs=U!C8G`Vn+%Vz%t8yUGX z^U{41D^rW~vWgd#aWL9XHtbQHykQ3))Nqc;-m97g{ed2W0JQ@NKt}rJ`ww&&7u7K> z=6=MoXcNn3?rjE4f@h&>K-4=RHs0*Bqli(^8%a18$hMe#{-q7KA3U5;{qkw|6f9u{ z@+%~e9=2&rUa(Ja@`4!}lXLdnnQVLf@TLP<%qStEu;~aB&*tAV|1mGR!Zdk8PZ-dv rs~8vE;9##6aLdV0ESa?G7HbN~SwMfpuoLa@&F5cMGH&*Nz0m*w&X2)t diff --git a/FloatingSpace/Bubble.js b/FloatingSpace/Bubble.js index 8306eaed8..4dee1d155 100644 --- a/FloatingSpace/Bubble.js +++ b/FloatingSpace/Bubble.js @@ -19,6 +19,12 @@ function newBubble() { function drawBackground(pFloatingObject) { + if (pFloatingObject.payloadBubbleIndex >= pFloatingObject.payload.bubbles.length) { + + return; // The bubbles array changed at the plotter before it was reflected here. We ignore this object from now on. + + } + if (pFloatingObject.currentRadius > 1) { /* Target Line */ @@ -51,6 +57,12 @@ function newBubble() { function drawForeground(pFloatingObject) { + if (pFloatingObject.payloadBubbleIndex >= pFloatingObject.payload.bubbles.length) { + + return; // The bubbles array changed at the plotter before it was reflected here. We ignore this object from now on. + + } + const BUBBLE_CORNERS_RADIOUS = 10; const TITLE_BAR_HEIGHT = 14; @@ -214,7 +226,7 @@ function newBubble() { const TOTAL_ROWS = 5; const ALPHA = Math.trunc(pFloatingObject.currentRadius / pFloatingObject.targetRadius * 100) / 100 / 2; - if (ALPHA > 0.3) { + if (ALPHA > 0.4) { let startingPosition = { x: pFloatingObject.currentPosition.x, @@ -232,11 +244,11 @@ function newBubble() { labelArray.push(word); - if (word.length > 10) { + if (word.length > 8) { labelArray.push(""); } - if (word.length > 12) { + if (word.length > 10) { labelArray.push(""); } } diff --git a/FloatingSpace/BubbleSets.js b/FloatingSpace/BubbleSets.js index 63090796c..84d1d9aec 100644 --- a/FloatingSpace/BubbleSets.js +++ b/FloatingSpace/BubbleSets.js @@ -59,9 +59,9 @@ function newBubbleSets() { let newFloatingBubbles = []; // We will create a new array of Floating Bubbles as a result of this operation. - for (let i = 0; i < bubbleSet.payload.bubbles.length; i++) { + for (let i = 0; i < pNewBubbles.length; i++) { - let plotterBubble = bubbleSet.payload.bubbles[i]; + let plotterBubble = pNewBubbles[i]; let plotterBubbleKey = plotterBubble.date.toString() + plotterBubble.rate.toString(); let found = false; @@ -93,7 +93,7 @@ function newBubbleSets() { floatingObject.initializeMass(200); - let bodyText = floatingObject.payload.bubbles[floatingObject.payloadBubbleIndex].body; + let bodyText = pNewBubbles[i].body; let radius; if (bodyText.length < 100) { @@ -131,9 +131,9 @@ function newBubbleSets() { let floatingBubble = bubbleSet.floatingBubbles[j]; let floatingBubbleKey = floatingBubble.date.toString() + floatingBubble.rate.toString(); - for (let i = 0; i < bubbleSet.payload.bubbles.length; i++) { + for (let i = 0; i < pNewBubbles.length; i++) { - let plotterBubble = bubbleSet.payload.bubbles[i]; + let plotterBubble = pNewBubbles[i]; let plotterBubbleKey = plotterBubble.date.toString() + plotterBubble.rate.toString(); if (plotterBubbleKey === floatingBubbleKey) { diff --git a/FloatingSpace/FloatingLayer.js b/FloatingSpace/FloatingLayer.js index 78df83d4f..38a7dc0d5 100644 --- a/FloatingSpace/FloatingLayer.js +++ b/FloatingSpace/FloatingLayer.js @@ -94,10 +94,11 @@ function newFloatingLayer() { } case "Bubble": { - // if (floatingObject.payloadBubbleIndex >= floatingObject.payload.bubbles.length) { + if (floatingObject.payloadBubbleIndex >= floatingObject.payload.bubbles.length) { - // continue; // The bubbles array changed at the plotter but the - //} + continue; // The bubbles array changed at the plotter before it was reflected here. We ignore this object. + + } payload.position = floatingObject.payload.bubbles[floatingObject.payloadBubbleIndex].position; payload.visible = floatingObject.payload.bubbles[floatingObject.payloadBubbleIndex].visible;