exiting editing mode on time
This commit is contained in:
1 parent
711829f46d
commit
f2e0a01522
4 files changed
+56
-40
No files matched your search
+14
-2
@@ -32,6 +32,7 @@ function newContainer () {
|
||||
let onMouseNotOverParentEvent = false
|
||||
let onFocusParentEvent = false
|
||||
let onNotFocusParentEvent = false
|
||||
let onDisplaceParentEvent = false
|
||||
|
||||
let isConnectedToParent = false
|
||||
|
||||
@@ -40,6 +41,7 @@ function newContainer () {
|
||||
let onMouseNotOverEventSubscriptionId
|
||||
let onFocusEventSubscriptionId
|
||||
let onNotFocusEventSubscriptionId
|
||||
let onDisplaceEventSubscriptionId
|
||||
|
||||
return thisObject
|
||||
|
||||
@@ -50,6 +52,7 @@ function newContainer () {
|
||||
thisObject.parentContainer.eventHandler.stopListening(onMouseNotOverEventSubscriptionId)
|
||||
thisObject.parentContainer.eventHandler.stopListening(onFocusEventSubscriptionId)
|
||||
thisObject.parentContainer.eventHandler.stopListening(onNotFocusEventSubscriptionId)
|
||||
thisObject.parentContainer.eventHandler.stopListening(onDisplaceEventSubscriptionId)
|
||||
|
||||
thisObject.parentContainer = undefined
|
||||
thisObject.eventHandler.finalize()
|
||||
@@ -82,7 +85,8 @@ function newContainer () {
|
||||
onMouseOverEvent,
|
||||
onMouseNotOverEvent,
|
||||
onFocusEvent,
|
||||
onNotFocusEvent
|
||||
onNotFocusEvent,
|
||||
onDisplaceEvent
|
||||
) {
|
||||
connectedToParentWidth = onWidth
|
||||
connectedToParentHeight = onHeight
|
||||
@@ -93,6 +97,7 @@ function newContainer () {
|
||||
onMouseNotOverParentEvent = onMouseNotOverEvent
|
||||
onFocusParentEvent = onFocusEvent
|
||||
onNotFocusParentEvent = onNotFocusEvent
|
||||
onDisplaceParentEvent = onDisplaceEvent
|
||||
|
||||
isConnectedToParent = true
|
||||
|
||||
@@ -115,6 +120,9 @@ function newContainer () {
|
||||
if (onNotFocusParentEvent === true) {
|
||||
onNotFocusEventSubscriptionId = thisObject.parentContainer.eventHandler.listenToEvent('onNotFocus', onNotFocus)
|
||||
}
|
||||
if (onDisplaceParentEvent === true) {
|
||||
onDisplaceEventSubscriptionId = thisObject.parentContainer.eventHandler.listenToEvent('onDisplace', onDisplace)
|
||||
}
|
||||
|
||||
if (connectedToParentWidth) {
|
||||
thisObject.frame.width = thisObject.parentContainer.frame.width
|
||||
@@ -163,6 +171,10 @@ function newContainer () {
|
||||
thisObject.eventHandler.raiseEvent('onNotFocus', event)
|
||||
}
|
||||
|
||||
function onDisplace (event) {
|
||||
thisObject.eventHandler.raiseEvent('onDisplace', event)
|
||||
}
|
||||
|
||||
function isForThisPurpose (purpose) {
|
||||
if (purpose !== undefined) {
|
||||
switch (purpose) {
|
||||
@@ -217,7 +229,7 @@ function newContainer () {
|
||||
if (thisObject.notDraggingOnY === false) {
|
||||
thisObject.frame.position.y = thisObject.frame.position.y + point.y
|
||||
}
|
||||
thisObject.eventHandler.raiseEvent('onDisplace', event)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,14 +38,14 @@ function newStrategyPart () {
|
||||
|
||||
let selfFocusEventSubscriptionId
|
||||
let selfNotFocuskEventSubscriptionId
|
||||
let selfMouseClickEventSubscriptionId
|
||||
let selfDisplaceEventSubscriptionId
|
||||
|
||||
return thisObject
|
||||
|
||||
function finalize () {
|
||||
thisObject.container.eventHandler.stopListening(selfFocusEventSubscriptionId)
|
||||
thisObject.container.eventHandler.stopListening(selfNotFocuskEventSubscriptionId)
|
||||
thisObject.container.eventHandler.stopListening(selfMouseClickEventSubscriptionId)
|
||||
thisObject.container.eventHandler.stopListening(selfDisplaceEventSubscriptionId)
|
||||
|
||||
thisObject.container.finalize()
|
||||
thisObject.container = undefined
|
||||
@@ -375,7 +375,7 @@ function newStrategyPart () {
|
||||
|
||||
selfFocusEventSubscriptionId = thisObject.container.eventHandler.listenToEvent('onFocus', onFocus)
|
||||
selfNotFocuskEventSubscriptionId = thisObject.container.eventHandler.listenToEvent('onNotFocus', onNotFocus)
|
||||
selfMouseClickEventSubscriptionId = thisObject.container.eventHandler.listenToEvent('onMouseClick', onMouseClick)
|
||||
selfDisplaceEventSubscriptionId = thisObject.container.eventHandler.listenToEvent('onDisplace', onDisplace)
|
||||
}
|
||||
|
||||
function getContainer (point) {
|
||||
@@ -427,8 +427,8 @@ function newStrategyPart () {
|
||||
}
|
||||
}
|
||||
|
||||
function onMouseClick (event) {
|
||||
|
||||
function onDisplace (event) {
|
||||
thisObject.partTitle.exitEditMode()
|
||||
}
|
||||
|
||||
function drawBackground () {
|
||||
|
||||
@@ -39,7 +39,7 @@ function newStrategyPartConstructor () {
|
||||
let strategyPart = newStrategyPart()
|
||||
strategyPart.fitFunction = canvas.floatingSpace.fitIntoVisibleArea
|
||||
strategyPart.initialize(payload)
|
||||
strategyPart.container.connectToParent(floatingObject.container, false, false, true, true, false, false, true, true)
|
||||
strategyPart.container.connectToParent(floatingObject.container, false, false, true, true, false, false, true, true, true)
|
||||
payload.uiObject = strategyPart
|
||||
|
||||
const FRICTION = 0.97
|
||||
|
||||
@@ -190,45 +190,49 @@ function newStrategyPartTitle () {
|
||||
}
|
||||
|
||||
function drawTitleBackground () {
|
||||
let params = {
|
||||
cornerRadius: 3,
|
||||
lineWidth: 0.1,
|
||||
container: thisObject.container,
|
||||
borderColor: UI_COLOR.BLACK,
|
||||
backgroundColor: UI_COLOR.BLACK,
|
||||
castShadow: false,
|
||||
opacity: 0.25
|
||||
}
|
||||
if (thisObject.editMode !== true) {
|
||||
let params = {
|
||||
cornerRadius: 3,
|
||||
lineWidth: 0.1,
|
||||
container: thisObject.container,
|
||||
borderColor: UI_COLOR.BLACK,
|
||||
backgroundColor: UI_COLOR.BLACK,
|
||||
castShadow: false,
|
||||
opacity: 0.25
|
||||
}
|
||||
|
||||
roundedCornersBackground(params)
|
||||
roundedCornersBackground(params)
|
||||
}
|
||||
}
|
||||
|
||||
function drawText () {
|
||||
let radius = thisObject.container.frame.radius
|
||||
let labelPoint
|
||||
let fontSize = thisObject.payload.floatingObject.currentFontSize
|
||||
let label
|
||||
if (thisObject.editMode !== true) {
|
||||
let radius = thisObject.container.frame.radius
|
||||
let labelPoint
|
||||
let fontSize = thisObject.payload.floatingObject.currentFontSize
|
||||
let label
|
||||
|
||||
if (radius > 6 && (thisObject.isOnFocus === true || thisObject.allwaysVisible === true)) {
|
||||
browserCanvasContext.strokeStyle = thisObject.payload.floatingObject.labelStrokeStyle
|
||||
|
||||
browserCanvasContext.font = fontSize + 'px ' + UI_FONT.PRIMARY
|
||||
|
||||
label = thisObject.payload.title
|
||||
|
||||
if (label !== undefined) {
|
||||
label = trimTitle(label)
|
||||
|
||||
labelPoint = {
|
||||
x: 0,
|
||||
y: thisObject.container.frame.height * 0.8
|
||||
}
|
||||
|
||||
labelPoint = thisObject.container.frame.frameThisPoint(labelPoint)
|
||||
if (radius > 6 && (thisObject.isOnFocus === true || thisObject.allwaysVisible === true)) {
|
||||
browserCanvasContext.strokeStyle = thisObject.payload.floatingObject.labelStrokeStyle
|
||||
|
||||
browserCanvasContext.font = fontSize + 'px ' + UI_FONT.PRIMARY
|
||||
browserCanvasContext.fillStyle = thisObject.payload.floatingObject.labelStrokeStyle
|
||||
browserCanvasContext.fillText(label, labelPoint.x, labelPoint.y)
|
||||
|
||||
label = thisObject.payload.title
|
||||
|
||||
if (label !== undefined) {
|
||||
label = trimTitle(label)
|
||||
|
||||
labelPoint = {
|
||||
x: 0,
|
||||
y: thisObject.container.frame.height * 0.8
|
||||
}
|
||||
|
||||
labelPoint = thisObject.container.frame.frameThisPoint(labelPoint)
|
||||
|
||||
browserCanvasContext.font = fontSize + 'px ' + UI_FONT.PRIMARY
|
||||
browserCanvasContext.fillStyle = thisObject.payload.floatingObject.labelStrokeStyle
|
||||
browserCanvasContext.fillText(label, labelPoint.x, labelPoint.y)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user