Tutorial part 2

This commit is contained in:
Luis Fernando Molina committed 2020-09-05 14:26:37 +02:00
1 parent 3e68bea2f2
commit 602076832c
3 files changed
+274 -1

No files matched your search

+47
View File
@@ -33,6 +33,7 @@ function newCanvas() {
topSpace: undefined,
sideSpace: undefined,
docSpace: undefined,
tutorialSpace: undefined,
chartingSpace: undefined,
floatingSpace: undefined,
panelsSpace: undefined,
@@ -62,6 +63,7 @@ function newCanvas() {
function finalize() {
try {
thisObject.tutorialSpace.finalize()
thisObject.docSpace.finalize()
thisObject.sideSpace.finalize()
thisObject.chartingSpace.finalize()
@@ -127,6 +129,9 @@ function newCanvas() {
thisObject.docSpace = newDocSpace()
thisObject.docSpace.initialize()
thisObject.tutorialSpace = newTutorialSpace()
thisObject.tutorialSpace.initialize()
thisObject.splashScreen = newSplashScreen()
let animation = newAnimation()
@@ -142,6 +147,7 @@ function newCanvas() {
animation.addCallBackFunction('Panels Space Physics', thisObject.panelsSpace.physics)
animation.addCallBackFunction('Side Space Physics', thisObject.sideSpace.physics)
animation.addCallBackFunction('Doc Space Physics', thisObject.docSpace.physics)
animation.addCallBackFunction('Tutorial Space Physics', thisObject.tutorialSpace.physics)
/* Spcaces Drawing */
animation.addCallBackFunction('Floating Space Draw', thisObject.floatingSpace.draw)
@@ -152,6 +158,7 @@ function newCanvas() {
animation.addCallBackFunction('Top Space Draw', thisObject.topSpace.draw)
animation.addCallBackFunction('Side Space Draw', thisObject.sideSpace.draw)
animation.addCallBackFunction('Doc Space Draw', thisObject.docSpace.draw)
animation.addCallBackFunction('Tutorial Space Draw', thisObject.tutorialSpace.draw)
animation.addCallBackFunction('Splash Screen Draw', thisObject.splashScreen.draw)
animation.start()
} catch (err) {
@@ -572,6 +579,20 @@ function newCanvas() {
let container
/* We check if the mouse is over an element of the Doc Space / */
container = thisObject.tutorialSpace.getContainer(point)
if (container !== undefined && container.isDraggeable === true) {
containerBeingDragged = container
containerDragStarted = true
containerBeingDragged.eventHandler.raiseEvent('onDragStarted', point)
return
}
if (container !== undefined && container.isDraggeable === false) {
return
}
/* We check if the mouse is over an element of the Doc Space / */
container = thisObject.docSpace.getContainer(point)
@@ -715,6 +736,14 @@ function newCanvas() {
let container
/* We check if the mouse is over an element of the Tutorial Space / */
container = thisObject.tutorialSpace.getContainer(point, GET_CONTAINER_PURPOSE.MOUSE_CLICK)
if (container !== undefined && container.isClickeable === true) {
container.eventHandler.raiseEvent('onMouseClick', point)
return
}
/* We check if the mouse is over an element of the Doc Space / */
container = thisObject.docSpace.getContainer(point, GET_CONTAINER_PURPOSE.MOUSE_CLICK)
@@ -865,6 +894,16 @@ function newCanvas() {
let container
/* We check if the mouse is over an element of the Tutorial Space / */
if (thisObject.tutorialSpace !== undefined) {
container = thisObject.tutorialSpace.getContainer(point, GET_CONTAINER_PURPOSE.MOUSE_OVER)
if (container !== undefined && container.detectMouseOver === true) {
containerFound()
return
}
}
/* We check if the mouse is over an element of the Doc Space / */
if (thisObject.docSpace !== undefined) {
container = thisObject.docSpace.getContainer(point, GET_CONTAINER_PURPOSE.MOUSE_OVER)
@@ -983,6 +1022,14 @@ function newCanvas() {
event.mousePosition = point
let container
/* Doc Space */
container = canvas.tutorialSpace.getContainer({ x: point.x, y: point.y })
if (container !== undefined && container.isWheelable === true) {
container.eventHandler.raiseEvent('onMouseWheel', event)
return false // This instructs the browser not to take the event and scroll the page.
}
/* Doc Space */
container = canvas.docSpace.getContainer({ x: point.x, y: point.y })
+31 -1
View File
@@ -638,7 +638,37 @@ function newWorkspace() {
break
case 'Play Tutorial':
{
functionLibraryTutorialFunctions.play(payload.node)
canvas.tutorialSpace.playTutorial(payload.node)
}
break
case 'Play Tutorial Topic':
{
canvas.tutorialSpace.playTutorialTopic(payload.node)
}
break
case 'Play Tutorial Step':
{
canvas.tutorialSpace.playTutorialStep(payload.node)
}
break
case 'Resume Tutorial':
{
canvas.tutorialSpace.resumeTutorial(payload.node)
}
break
case 'Resume Tutorial Topic':
{
canvas.tutorialSpace.resumeTutorialTopic(payload.node)
}
break
case 'Resume Tutorial Step':
{
canvas.tutorialSpace.resumeTutorialStep(payload.node)
}
break
case 'Reset Tutorial Progress':
{
canvas.tutorialSpace.resetTutorialProgress(payload.node)
}
break
case 'Send Webhook Test Message':
+196
View File
@@ -0,0 +1,196 @@
function newTutorialSpace() {
const MODULE_NAME = 'Tutorial Space'
let thisObject = {
playTutorial: playTutorial,
resumeTutorial: resumeTutorial,
stopTutorial: stopTutorial,
playTutorialTopic: playTutorialTopic,
resumeTutorialTopic: resumeTutorialTopic,
stopTutorialTopic: stopTutorialTopic,
playTutorialStep: playTutorialStep,
resumeTutorialStep: resumeTutorialStep,
stopTutorialStep: stopTutorialStep,
skipTutorialTopic: skipTutorialTopic,
skipTutorialStep: skipTutorialStep,
tutorialDone: tutorialDone,
tutorialTopicDone: tutorialTopicDone,
tutorialStepDone: tutorialStepDone,
resetTutorialProgress: resetTutorialProgress,
container: undefined,
physics: physics,
draw: draw,
getContainer: getContainer,
initialize: initialize,
finalize: finalize
}
let isInitialized = false
thisObject.container = newContainer()
thisObject.container.name = MODULE_NAME
thisObject.container.initialize()
thisObject.container.isClickeable = true
thisObject.container.isDraggeable = false
thisObject.container.detectMouseOver = true
thisObject.container.status = 'hidden'
resize()
let browserResizedEventSubscriptionId
let currentTutorialNode
let currentTutorialTopicNode
let currentTutorialStepNode
let currentStatus = 'Stopped'
let docAppDiv = document.getElementById('tutorialStepDiv')
return thisObject
function initialize() {
browserResizedEventSubscriptionId = canvas.eventHandler.listenToEvent('Browser Resized', resize)
isInitialized = true
}
function finalize() {
canvas.eventHandler.stopListening(browserResizedEventSubscriptionId)
currentTutorialNode = undefined
currentTutorialTopicNode = undefined
currentTutorialStepNode = undefined
docAppDiv = undefined
}
function resize() {
thisObject.container.frame.width = 0
thisObject.container.frame.height = 0
}
function getContainer(point, purpose) {
let container
if (thisObject.container.frame.isThisPointHere(point, true) === true) {
return thisObject.container
} else {
return undefined
}
}
function physics() {
switch (currentStatus) {
case 'Stopped': {
makeInvisible()
break
}
case 'Playing Tutorial': {
makeVsible()
break
}
}
function makeInvisible() {
const HEIGHT = 0
const WIDTH = 0
tutorialPosition = {
x: 100000,
y: 100000
}
docAppDiv.style = ' ' +
'position:fixed; top:' + tutorialPosition.y + 'px; ' +
'left:' + tutorialPosition.x + 'px; ' +
'width: ' + WIDTH + 'px;' +
'height: ' + HEIGHT + 'px;' +
'z-index:1;'
}
function makeVsible() {
const HEIGHT = 800
const WIDTH = 500
const MARGIN = 300
tutorialPosition = {
x: MARGIN,
y: (browserCanvas.height - HEIGHT) / 2
}
docAppDiv.style = ' ' +
'position:fixed; top:' + tutorialPosition.y + 'px; ' +
'left:' + tutorialPosition.x + 'px; ' +
'width: ' + WIDTH + 'px;' +
'height: ' + HEIGHT + 'px;' +
'z-index:1;'
}
}
function playTutorial(node) {
currentTutorialNode = node
currentStatus = 'Playing Tutorial'
}
function resumeTutorial(node) {
}
function stopTutorial() {
currentTutorialNode = undefined
currentTutorialTopicNode = undefined
currentTutorialStepNode = undefined
currentStatus = 'Stopped'
}
function playTutorialTopic(node) {
}
function resumeTutorialTopic(node) {
}
function stopTutorialTopic() {
}
function playTutorialStep(node) {
}
function resumeTutorialStep(node) {
}
function stopTutorialStep() {
}
function skipTutorialTopic() {
}
function skipTutorialStep() {
}
function tutorialDone() {
}
function tutorialTopicDone() {
}
function tutorialStepDone() {
}
function resetTutorialProgress() {
}
function draw() {
if (isInitialized === false) { return }
}
}