Code edit (3 edits merged)
Please save this source code
User prompt
Fix Bug: 'TypeError: console.Log is not a function' in or related to this line: 'console.Log("FIXING GAP : " + moveSegmentsVertically < 0 ? downwardGapFix : 0);' Line Number: 90
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
User prompt
Here is current code: ``` var pointA = graphPoints[graphIndex]; var pointB = graphPoints[graphIndex + 1]; var deltaY = pointB.y - pointA.y; // Calculate next segment rotation based on pointA and pointB coordinates var deltaX = pointB.x - pointA.x; var nextSegmentRotation = Math.atan2(deltaY, deltaX); var distance = Math.sqrt(Math.pow(pointB.x - pointA.x, 2) + Math.pow(pointB.y - pointA.y, 2)); var lastSegment = graphSegments.length > 0 ? graphSegments[graphSegments.length - 1] : null; var lastSegmentEndX = lastSegment ? lastSegment.x + Math.cos(lastSegment.rotation) * lastSegment.width : graphPoints[graphIndex].x; var lastSegmentEndY = lastSegment ? lastSegment.y + Math.sin(lastSegment.rotation) * lastSegment.width : graphPoints[graphIndex].y; pointA.x = lastSegmentEndX; pointA.y = lastSegmentEndY; // Re-compute the rotation (rotation * (180 / Math.PI)).toFixed(2) var deltaY2 = pointB.y - pointA.y; // Calculate next segment rotation based on pointA and pointB coordinates var deltaX2 = pointB.x - pointA.x; var tempRotFixed = Math.atan2(deltaY2, deltaX2); if (deltaX2 < 0 || deltaY > 0) { tempRotFixed += Math.PI; } var tempRotFixedDeltaDeg = ((nextSegmentRotation - tempRotFixed) * (180 / Math.PI)).toFixed(0); console.log('original rotation Rad: ' + nextSegmentRotation + ' / fixed rotation Rad :' + tempRotFixed + " -> Delta Deg " + tempRotFixedDeltaDeg); ``` And here is produced log : ``` original rotation Rad: -1.0305921674056044 / fixed rotation Rad :-1.0084043587880687 -> Delta Deg -1 Start moveSegmentsVertically Please draw graphIndex=9 1242,-254 / Rot= -59 distance=796.4051481501108 new segment index=9-10 450-500$ 1242 -254 rotation=-59.05 degrees width=796 original rotation Rad: -1.0305921674056038 / fixed rotation Rad :-1.0109702920137162 -> Delta Deg -1 Start moveSegmentsVertically Please draw graphIndex=10 1249,-268 / Rot= -59 distance=796.405148150111 new segment index=10-11 500-550$ 1249 -268 rotation=-59.05 degrees width=796 original rotation Rad: 1.0305921674056038 / fixed rotation Rad :2.2522788402901393 -> Delta Deg -70 Start moveSegmentsVertically Please draw graphIndex=11 1262,-278 / Rot= 59 distance=796.405148150111 new segment index=11-12 550-500$ 1262 -278 rotation=59.05 degrees width=796 original rotation Rad: 1.0305921674056049 / fixed rotation Rad :2.234469655823067 -> Delta Deg -69 ``` What change to tempRotFixed should be done to keep the delta around -1 ??
Code edit (1 edits merged)
Please save this source code
User prompt
Here is the rotation calculation : var deltaY = pointB.y - pointA.y; // Calculate next segment rotation based on pointA and pointB coordinates var deltaX = pointB.x - pointA.x; var nextSegmentRotation = Math.atan2(deltaY, deltaX); if (deltaX < 0) { nextSegmentRotation += Math.PI; } shouldn't it check deltaY too ?
Code edit (15 edits merged)
Please save this source code
User prompt
ok, but what should be changed to the line : var nextSegmentRotation = Math.atan2(pointB.y - pointA.y, pointB.x - pointA.x); to take into account the direction ?
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
Code edit (12 edits merged)
Please save this source code
User prompt
UPDATE BUY BUTTON STATUS WHEN STOCK VALUE CHANGES. (Hint: When graphIndex changes)
User prompt
Fix buy button status
User prompt
Update buy button status every time stock value changes or balance changes
User prompt
Like for sell button, disable buy button when current stock price is above balance
Code edit (1 edits merged)
Please save this source code
Code edit (9 edits merged)
Please save this source code
User prompt
Pad timer text with 0 so the text length is always 3
Code edit (7 edits merged)
Please save this source code
User prompt
Fix Bug: 'Timeout.tick error: timerText.updateTime is not a function. (In 'timerText.updateTime(currentTime)', 'timerText.updateTime' is undefined)' in or related to this line: 'timerText.updateTime(currentTime);' Line Number: 551
User prompt
Update declaration of timerText to make it like balanceText and stockNumber, do not use a class
Code edit (1 edits merged)
Please save this source code
User prompt
For timer, use currentTime=nbTotalStock-graphIndex
User prompt
Fix Bug: 'Timeout.tick error: Can't find variable: startTime' in or related to this line: 'var currentTime = Math.floor((Date.now() - startTime) / 1000);' Line Number: 554
===================================================================
--- original.js
+++ change.js
@@ -441,9 +441,9 @@
var pointB = graphPoints[graphIndex + 1];
var deltaY = pointB.y - pointA.y; // Calculate next segment rotation based on pointA and pointB coordinates
var deltaX = pointB.x - pointA.x;
var nextSegmentRotation = Math.atan2(deltaY, deltaX);
- if (deltaX < 0 || deltaY < 0) {
+ if (deltaX < 0 || deltaY > 0) {
nextSegmentRotation += Math.PI;
}
var distance = Math.sqrt(Math.pow(pointB.x - pointA.x, 2) + Math.pow(pointB.y - pointA.y, 2)); // Calculate the distance between points A and B
var lastSegment = graphSegments.length > 0 ? graphSegments[graphSegments.length - 1] : null;
A Technical dark background. Nothing just a gradiant of colors from black to dark blue. Theme : stock market. background
A modern clean empty rectangular button without borders. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
without shadow
a basic empty ui popup with a black background. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.