Improves on Focus
This commit is contained in:
1 parent
e978cd396b
commit
1edaadd71e
3 files changed
+42
-5
No files matched your search
@@ -169,19 +169,19 @@ function newCircularMenuItem () {
|
||||
if (thisObject.type === 'Icon Only') {
|
||||
switch (thisObject.ring) {
|
||||
case 1: {
|
||||
radiusGrowthFactor = 6.5
|
||||
radiusGrowthFactor = 5.5
|
||||
break
|
||||
}
|
||||
case 2: {
|
||||
radiusGrowthFactor = 5.0
|
||||
radiusGrowthFactor = 4.0
|
||||
break
|
||||
}
|
||||
case 3: {
|
||||
radiusGrowthFactor = 3.5
|
||||
radiusGrowthFactor = 3.0
|
||||
break
|
||||
}
|
||||
case 4: {
|
||||
radiusGrowthFactor = 2.5
|
||||
radiusGrowthFactor = 2.0
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
@@ -433,7 +433,7 @@ function newFloatingObject () {
|
||||
thisObject.targetFontSize = thisObject.rawFontSize * 1
|
||||
thisObject.targetHierarchyRing = thisObject.rawHierarchyRing * 1
|
||||
|
||||
thisObject.payload.uiObject.container.eventHandler.raiseEvent('onNotFocus')
|
||||
thisObject.payload.uiObject.container.eventHandler.raiseEvent('onNotFocus', thisObject.container)
|
||||
|
||||
if (thisObject.isPinned !== true) {
|
||||
thisObject.positionLocked = false
|
||||
|
||||
@@ -57,14 +57,21 @@ function newFloatingSpace () {
|
||||
thisObject.container.frame.position.y = browserCanvas.height / 2 - thisObject.container.frame.height / 2
|
||||
|
||||
let visible = false
|
||||
let containerOnFocus
|
||||
|
||||
const PERCENTAGE_OF_SCREEN_FOR_DISPLACEMENT = 25
|
||||
let onDragStartedEventSubscriptionId
|
||||
let spaceFocusAquiredEventSubscriptionId
|
||||
let containerOnFocusEventSubscriptionId
|
||||
|
||||
return thisObject
|
||||
|
||||
function finalize () {
|
||||
thisObject.container.eventHandler.stopListening(onDragStartedEventSubscriptionId)
|
||||
canvas.floatingSpace.container.eventHandler.stopListening(spaceFocusAquiredEventSubscriptionId)
|
||||
if (containerOnFocus !== undefined) {
|
||||
containerOnFocus.eventHandler.stopListening(containerOnFocusEventSubscriptionId)
|
||||
}
|
||||
|
||||
thisObject.floatingLayer.finalize()
|
||||
thisObject.uiObjectConstructor.finalize()
|
||||
@@ -73,6 +80,8 @@ function newFloatingSpace () {
|
||||
thisObject.floatingLayer = undefined
|
||||
thisObject.uiObjectConstructor = undefined
|
||||
thisObject.container = undefined
|
||||
|
||||
containerOnFocus = undefined
|
||||
}
|
||||
|
||||
function initialize (callBackFunction) {
|
||||
@@ -83,6 +92,26 @@ function newFloatingSpace () {
|
||||
thisObject.uiObjectConstructor.initialize(thisObject.floatingLayer)
|
||||
|
||||
onDragStartedEventSubscriptionId = thisObject.container.eventHandler.listenToEvent('onDragStarted', onDragStarted)
|
||||
spaceFocusAquiredEventSubscriptionId = canvas.floatingSpace.container.eventHandler.listenToEvent('onFocusAquired', someoneAquiredFocus)
|
||||
}
|
||||
|
||||
function someoneAquiredFocus (container) {
|
||||
if (container === undefined) {
|
||||
return
|
||||
}
|
||||
containerOnFocus = container
|
||||
containerOnFocusEventSubscriptionId = containerOnFocus.eventHandler.listenToEvent('onNotFocus', onNotFocus)
|
||||
}
|
||||
|
||||
function onNotFocus (container) {
|
||||
if (container !== undefined) {
|
||||
container.eventHandler.stopListening(containerOnFocusEventSubscriptionId)
|
||||
}
|
||||
if (containerOnFocus !== undefined) {
|
||||
if (containerOnFocus.id === container.id) {
|
||||
containerOnFocus = undefined
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function toggleDrawReferenceLines () {
|
||||
@@ -347,8 +376,16 @@ function newFloatingSpace () {
|
||||
|
||||
function getContainer (point) {
|
||||
if (visible === false) { return }
|
||||
|
||||
let container
|
||||
|
||||
if (containerOnFocus !== undefined) {
|
||||
if (containerOnFocus.frame.isThisScreenPointHere(point) === true) {
|
||||
containerOnFocus.space = 'Floating Space'
|
||||
return containerOnFocus
|
||||
}
|
||||
}
|
||||
|
||||
container = thisObject.floatingLayer.getContainer(point)
|
||||
if (container !== undefined) {
|
||||
container.space = 'Floating Space'
|
||||
|
||||
Reference in new issue
Block a user