radius moved to the radius at the frame
This commit is contained in:
1 parent
10ca03678c
commit
7f735c1d8e
6 files changed
+37
-41
No files matched your search
@@ -433,13 +433,10 @@ function newCanvas () {
|
||||
}
|
||||
|
||||
/* We check if the mouse is over a floatingObject/ */
|
||||
container = thisObject.floatingSpace.getContainer(point)
|
||||
|
||||
let floatingObjectBeingClicked = thisObject.floatingSpace.floatingLayer.isInside(point.x, point.y)
|
||||
|
||||
if (floatingObjectBeingClicked >= 0) {
|
||||
let floatingObject = thisObject.floatingSpace.floatingLayer.getFloatingObject(undefined, floatingObjectBeingClicked)
|
||||
floatingObject.container.eventHandler.raiseEvent('onMouseClick', point)
|
||||
|
||||
if (container !== undefined && container.isClickeable === true) {
|
||||
container.eventHandler.raiseEvent('onMouseClick', point)
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -413,11 +413,11 @@ function newFloatingLayer () {
|
||||
|
||||
// The radius also have a target.
|
||||
|
||||
if (Math.abs(floatingObject.currentRadius - floatingObject.targetRadius) >= 1) {
|
||||
if (floatingObject.currentRadius < floatingObject.targetRadius) {
|
||||
floatingObject.currentRadius = floatingObject.currentRadius + 0.5
|
||||
if (Math.abs(floatingObject.container.frame.radius - floatingObject.targetRadius) >= 1) {
|
||||
if (floatingObject.container.frame.radius < floatingObject.targetRadius) {
|
||||
floatingObject.container.frame.radius = floatingObject.container.frame.radius + 0.5
|
||||
} else {
|
||||
floatingObject.currentRadius = floatingObject.currentRadius - 0.5
|
||||
floatingObject.container.frame.radius = floatingObject.container.frame.radius - 0.5
|
||||
}
|
||||
}
|
||||
|
||||
@@ -625,10 +625,10 @@ function newFloatingLayer () {
|
||||
for (let i = 0; i < dyingFloatingObjects.length; i++) {
|
||||
let floatingObject = dyingFloatingObjects[i]
|
||||
|
||||
if (Math.abs(floatingObject.currentRadius - floatingObject.targetRadius) >= 5) {
|
||||
if (Math.abs(floatingObject.container.frame.radius - floatingObject.targetRadius) >= 5) {
|
||||
let speed = Math.random()
|
||||
|
||||
floatingObject.currentRadius = floatingObject.currentRadius - speed * 3
|
||||
floatingObject.container.frame.radius = floatingObject.container.frame.radius - speed * 3
|
||||
} else {
|
||||
/* Here is when the floatingObjects are definetelly killed. */
|
||||
|
||||
@@ -891,8 +891,8 @@ function newFloatingLayer () {
|
||||
|
||||
/* This function detects weather 2 floatingObjects collide with each other. */
|
||||
|
||||
var r1 = floatingObject1.currentRadius
|
||||
var r2 = floatingObject2.currentRadius
|
||||
var r1 = floatingObject1.container.frame.radius
|
||||
var r2 = floatingObject2.container.frame.radius
|
||||
|
||||
var distance = Math.sqrt(Math.pow(floatingObject2.container.frame.position.x - floatingObject1.container.frame.position.x, 2) + Math.pow(floatingObject2.container.frame.position.y - floatingObject1.container.frame.position.y, 2))
|
||||
|
||||
@@ -919,7 +919,7 @@ function newFloatingLayer () {
|
||||
var floatingObject = visibleFloatingObjects[i]
|
||||
var distance = Math.sqrt(Math.pow(floatingObject.container.frame.position.x - x, 2) + Math.pow(floatingObject.container.frame.position.y - y, 2))
|
||||
|
||||
if (distance < floatingObject.currentRadius) {
|
||||
if (distance < floatingObject.container.frame.radius) {
|
||||
return i
|
||||
}
|
||||
}
|
||||
@@ -938,7 +938,7 @@ function newFloatingLayer () {
|
||||
var floatingObject = visibleFloatingObjects[floatingObjectIndex]
|
||||
var distance = Math.sqrt(Math.pow(floatingObject.container.frame.position.x - x, 2) + Math.pow(floatingObject.container.frame.position.y - y, 2))
|
||||
|
||||
if (distance < floatingObject.currentRadius) {
|
||||
if (distance < floatingObject.container.frame.radius) {
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -1010,7 +1010,7 @@ function newFloatingLayer () {
|
||||
var d = Math.sqrt(Math.pow(floatingObject2.container.frame.position.x - floatingObject1.container.frame.position.x, 2) + Math.pow(floatingObject2.container.frame.position.y - floatingObject1.container.frame.position.y, 2))
|
||||
|
||||
// minimum translation distance to push floatingObjects apart after intersecting
|
||||
var scalar = (((floatingObject1.currentRadius + floatingObject2.currentRadius) - d) / d)
|
||||
var scalar = (((floatingObject1.container.frame.radius + floatingObject2.container.frame.radius) - d) / d)
|
||||
|
||||
var minTD = {
|
||||
x: posDiff.x * scalar,
|
||||
|
||||
@@ -26,7 +26,6 @@ function newFloatingObject () {
|
||||
imageId: undefined,
|
||||
|
||||
currentSpeed: 0, // This is the current speed of the floating object.
|
||||
currentRadius: 0, // This is the current radius of the floating object, including its zoom applied.
|
||||
currentMass: 0, // This is the current mass of the floating object, including its zoom applied.
|
||||
|
||||
friction: 0, // This is a factor that will ultimatelly desacelerate the floating object.
|
||||
@@ -187,7 +186,7 @@ function newFloatingObject () {
|
||||
|
||||
thisObject.rawRadius = radius
|
||||
thisObject.targetRadius = radius
|
||||
thisObject.currentRadius = radius / 3
|
||||
thisObject.container.frame.radius = radius / 3
|
||||
}
|
||||
|
||||
function initializeImageSize (suggestedValue) {
|
||||
|
||||
@@ -63,7 +63,7 @@ function newNote () {
|
||||
|
||||
point = viewPort.fitIntoVisibleArea(point)
|
||||
|
||||
if (pFloatingObject.currentRadius > 1) {
|
||||
if (pFloatingObject.container.frame.radius > 1) {
|
||||
/* Target Line */
|
||||
|
||||
browserCanvasContext.beginPath()
|
||||
@@ -76,7 +76,7 @@ function newNote () {
|
||||
browserCanvasContext.setLineDash([0, 0])
|
||||
}
|
||||
|
||||
if (pFloatingObject.currentRadius > 0.5) {
|
||||
if (pFloatingObject.container.frame.radius > 0.5) {
|
||||
/* Target Spot */
|
||||
|
||||
var radius = 1
|
||||
@@ -93,8 +93,8 @@ function newNote () {
|
||||
const BUBBLE_CORNERS_RADIOUS = 5
|
||||
const TITLE_BAR_HEIGHT = 14
|
||||
|
||||
const BUBBLE_WIDTH = BUBBLE_CORNERS_RADIOUS + pFloatingObject.currentRadius * 4
|
||||
const BUBBLE_HEIGHT = BUBBLE_CORNERS_RADIOUS + pFloatingObject.currentRadius * 2
|
||||
const BUBBLE_WIDTH = BUBBLE_CORNERS_RADIOUS + pFloatingObject.container.frame.radius * 4
|
||||
const BUBBLE_HEIGHT = BUBBLE_CORNERS_RADIOUS + pFloatingObject.container.frame.radius * 2
|
||||
|
||||
let borderPoint1
|
||||
let borderPoint2
|
||||
@@ -106,7 +106,7 @@ function newNote () {
|
||||
y: pFloatingObject.container.frame.position.y - BUBBLE_HEIGHT / 2
|
||||
}
|
||||
|
||||
if (pFloatingObject.currentRadius > 5) {
|
||||
if (pFloatingObject.container.frame.radius > 5) {
|
||||
/* Rounded Background */
|
||||
|
||||
borderPoint1 = {
|
||||
@@ -181,7 +181,7 @@ function newNote () {
|
||||
browserCanvasContext.stroke()
|
||||
}
|
||||
|
||||
if (pFloatingObject.currentRadius > 0.5) {
|
||||
if (pFloatingObject.container.frame.radius > 0.5) {
|
||||
/* Image */
|
||||
|
||||
let imagePosition = {
|
||||
@@ -208,10 +208,10 @@ function newNote () {
|
||||
|
||||
/* Labels */
|
||||
|
||||
if (pFloatingObject.currentRadius > 6) {
|
||||
if (pFloatingObject.container.frame.radius > 6) {
|
||||
browserCanvasContext.strokeStyle = pFloatingObject.labelStrokeStyle
|
||||
|
||||
const SIZE_PERCENTAGE = Math.trunc(pFloatingObject.currentRadius / pFloatingObject.targetRadius * 100) / 100
|
||||
const SIZE_PERCENTAGE = Math.trunc(pFloatingObject.container.frame.radius / pFloatingObject.targetRadius * 100) / 100
|
||||
let ALPHA
|
||||
|
||||
if (pFloatingObject.targetRadius > 0) {
|
||||
@@ -219,7 +219,7 @@ function newNote () {
|
||||
} else {
|
||||
// Object is dying...
|
||||
|
||||
ALPHA = Math.trunc((0.5 - (100 - pFloatingObject.currentRadius / 100)) * 100) / 100
|
||||
ALPHA = Math.trunc((0.5 - (100 - pFloatingObject.container.frame.radius / 100)) * 100) / 100
|
||||
|
||||
if (ALPHA < 0) { ALPHA = 0 }
|
||||
}
|
||||
|
||||
@@ -190,7 +190,7 @@ function newProfileBall () {
|
||||
|
||||
point = viewPort.fitIntoVisibleArea(point)
|
||||
|
||||
if (pFloatingObject.currentRadius > 1) {
|
||||
if (pFloatingObject.container.frame.radius > 1) {
|
||||
/* Target Line */
|
||||
|
||||
browserCanvasContext.beginPath()
|
||||
@@ -203,7 +203,7 @@ function newProfileBall () {
|
||||
browserCanvasContext.setLineDash([0, 0])
|
||||
}
|
||||
|
||||
if (pFloatingObject.currentRadius > 0.5) {
|
||||
if (pFloatingObject.container.frame.radius > 0.5) {
|
||||
/* Target Spot */
|
||||
|
||||
var radius = 1
|
||||
@@ -217,23 +217,23 @@ function newProfileBall () {
|
||||
}
|
||||
|
||||
function drawForeground (pFloatingObject) {
|
||||
if (pFloatingObject.currentRadius > 5) {
|
||||
if (pFloatingObject.container.frame.radius > 5) {
|
||||
/* Contourn */
|
||||
|
||||
browserCanvasContext.beginPath()
|
||||
browserCanvasContext.arc(pFloatingObject.container.frame.position.x, pFloatingObject.container.frame.position.y, pFloatingObject.currentRadius, 0, Math.PI * 2, true)
|
||||
browserCanvasContext.arc(pFloatingObject.container.frame.position.x, pFloatingObject.container.frame.position.y, pFloatingObject.container.frame.radius, 0, Math.PI * 2, true)
|
||||
browserCanvasContext.closePath()
|
||||
browserCanvasContext.strokeStyle = 'rgba(30, 30, 30, 0.75)'
|
||||
browserCanvasContext.lineWidth = 1
|
||||
browserCanvasContext.stroke()
|
||||
}
|
||||
|
||||
if (pFloatingObject.currentRadius > 0.5) {
|
||||
if (pFloatingObject.container.frame.radius > 0.5) {
|
||||
/* Main FloatingObject */
|
||||
|
||||
var alphaA
|
||||
|
||||
if (pFloatingObject.currentRadius < 3) {
|
||||
if (pFloatingObject.container.frame.radius < 3) {
|
||||
alphaA = 1
|
||||
} else {
|
||||
alphaA = 0.75
|
||||
@@ -242,7 +242,7 @@ function newProfileBall () {
|
||||
alphaA = 0.75
|
||||
|
||||
browserCanvasContext.beginPath()
|
||||
browserCanvasContext.arc(pFloatingObject.container.frame.position.x, pFloatingObject.container.frame.position.y, pFloatingObject.currentRadius, 0, Math.PI * 2, true)
|
||||
browserCanvasContext.arc(pFloatingObject.container.frame.position.x, pFloatingObject.container.frame.position.y, pFloatingObject.container.frame.radius, 0, Math.PI * 2, true)
|
||||
browserCanvasContext.closePath()
|
||||
|
||||
browserCanvasContext.fillStyle = pFloatingObject.fillStyle
|
||||
@@ -287,7 +287,7 @@ function newProfileBall () {
|
||||
|
||||
/* Label Text */
|
||||
|
||||
if (pFloatingObject.currentRadius > 6) {
|
||||
if (pFloatingObject.container.frame.radius > 6) {
|
||||
browserCanvasContext.strokeStyle = pFloatingObject.labelStrokeStyle
|
||||
|
||||
let labelPoint
|
||||
|
||||
@@ -334,8 +334,8 @@ function newStrategyPart () {
|
||||
|
||||
if (menuItem.canDrawIcon === true && menuItem.currentRadius > 1) {
|
||||
let position = {
|
||||
x: pFloatingObject.container.frame.position.x + pFloatingObject.currentRadius * 3 / 4 * Math.cos(toRadians(menuItem.angle)),
|
||||
y: pFloatingObject.container.frame.position.y - pFloatingObject.currentRadius * 3 / 4 * Math.sin(toRadians(menuItem.angle))
|
||||
x: pFloatingObject.container.frame.position.x + pFloatingObject.container.frame.radius * 3 / 4 * Math.cos(toRadians(menuItem.angle)),
|
||||
y: pFloatingObject.container.frame.position.y - pFloatingObject.container.frame.radius * 3 / 4 * Math.sin(toRadians(menuItem.angle))
|
||||
}
|
||||
|
||||
browserCanvasContext.drawImage(menuItem.icon, position.x, position.y, menuItem.currentRadius * 2, menuItem.currentRadius * 2)
|
||||
@@ -396,7 +396,7 @@ function newStrategyPart () {
|
||||
y: pFloatingObject.payload.profile.position.y
|
||||
}
|
||||
|
||||
if (pFloatingObject.currentRadius > 1) {
|
||||
if (pFloatingObject.container.frame.radius > 1) {
|
||||
/* Target Line */
|
||||
|
||||
browserCanvasContext.beginPath()
|
||||
@@ -409,7 +409,7 @@ function newStrategyPart () {
|
||||
browserCanvasContext.setLineDash([0, 0])
|
||||
}
|
||||
|
||||
if (pFloatingObject.currentRadius > 0.5) {
|
||||
if (pFloatingObject.container.frame.radius > 0.5) {
|
||||
/* Target Spot */
|
||||
|
||||
var radius = 1
|
||||
@@ -428,7 +428,7 @@ function newStrategyPart () {
|
||||
y: pFloatingObject.container.frame.position.y
|
||||
}
|
||||
|
||||
let radius = pFloatingObject.currentRadius
|
||||
let radius = pFloatingObject.container.frame.radius
|
||||
|
||||
if (radius > 5) {
|
||||
/* Contourn */
|
||||
|
||||
Reference in new issue
Block a user