button navigator step changed

pull/1/head
Iuri Matias 6 years ago committed by yann300
parent fd133e16eb
commit 1d9f85dfb3
  1. 58
      src/app/debugger/debuggerUI/ButtonNavigator.js
  2. 2
      src/app/debugger/debuggerUI/Slider.js
  3. 21
      src/app/debugger/debuggerUI/StepManager.js

@ -88,8 +88,6 @@ function ButtonNavigator (_parent, _traceManager) {
this.view
}
module.exports = ButtonNavigator
ButtonNavigator.prototype.render = function () {
var self = this
var view = yo`<div class="${css.buttons}">
@ -130,29 +128,43 @@ ButtonNavigator.prototype.reset = function () {
resetWarning(this)
}
ButtonNavigator.prototype.stepChanged = function (step) {
ButtonNavigator.prototype.stepChanged = function (stepState, jumpOutDisabled) {
if (stepState === 'invalid') {
// TODO: probably not necessary, already implicit done in the next steps
this.reset()
this.updateAll()
return
}
this.intoBackDisabled = (stepState === 'initial')
this.overBackDisabled = (stepState === 'initial')
this.jumpPreviousBreakpointDisabled = (stepState === 'initial')
this.jumpNextBreakpointDisabled = (stepState === 'end')
this.intoForwardDisabled = (stepState === 'end')
this.overForwardDisabled = (stepState === 'end')
this.jumpNextBreakpointDisabled = jumpOutDisabled
this.updateAll()
}
ButtonNavigator.prototype.old_stepChanged = function (step) {
var self = this
this.intoBackDisabled = step <= 0
this.overBackDisabled = step <= 0
if (!this.traceManager) {
this.intoForwardDisabled = true
this.overForwardDisabled = true
} else {
var self = this
this.traceManager.getLength(function (error, length) {
if (error) {
self.reset()
console.log(error)
} else {
self.jumpNextBreakpointDisabled = step >= length - 1
self.jumpPreviousBreakpointDisabled = step <= 0
self.intoForwardDisabled = step >= length - 1
self.overForwardDisabled = step >= length - 1
var stepOut = self.traceManager.findStepOut(step)
self.jumpOutDisabled = stepOut === step
}
self.updateAll()
})
}
this.traceManager.getLength(function (error, length) {
if (error) {
console.log(error)
self.reset()
} else {
self.jumpNextBreakpointDisabled = step >= length - 1
self.jumpPreviousBreakpointDisabled = step <= 0
self.intoForwardDisabled = step >= length - 1
self.overForwardDisabled = step >= length - 1
var stepOut = self.traceManager.findStepOut(step)
self.jumpOutDisabled = stepOut === step
}
self.updateAll()
})
this.updateAll()
}

@ -63,7 +63,7 @@ class Slider {
if (value === this.previousValue) return
this.previousValue = value
this.event.trigger('moved', [value])
this.event.trigger('sliderMoved', [value])
}
setValue (value) {

@ -29,7 +29,7 @@ function StepManager (_parent, _traceManager) {
this.slider = new Slider((step) => {
return this.solidityMode ? this.resolveToReducedTrace(step, 0) : step
})
this.slider.event.register('moved', this, function (step) {
this.slider.event.register('sliderMoved', this, function (step) {
self.sliderMoved(step)
})
@ -197,8 +197,25 @@ StepManager.prototype.jumpOut = function () {
}
StepManager.prototype.changeState = function (step) {
const self = this
this.currentStepIndex = step
this.buttonNavigator.stepChanged(step)
this.traceManager.getLength(function (error, length) {
let stepState = 'valid'
if (error) {
stepState = 'invalid'
} else if (step <= 0) {
stepState = 'initial'
} else if (step >= length - 1) {
stepState = 'end'
}
let jumpOutDisabled = (step === self.traceManager.findStepOut(step))
self.buttonNavigator.stepChanged(stepState, jumpOutDisabled)
})
this.event.trigger('stepChanged', [step])
}

Loading…
Cancel
Save