ela 4.1.5 → 4.1.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2dd24a913ce3b0478b22f51fe288628f098589012e0d3639e1a5b3b9808f6674
4
- data.tar.gz: 057e1f3257684cb9140f7820b14f78f2269bb6d2489a81f33fef1b183785696d
3
+ metadata.gz: c64b64f369d8208adc4ca837614a1c4aa5d3234c1ae22fdab8eb8f209973ec00
4
+ data.tar.gz: 96a808ce8df7c572ea2338e0dcb538a5ca407315524613eb4dd97d9363e39642
5
5
  SHA512:
6
- metadata.gz: 124c0db803497139033fe8a35e9c9a18776a2121b88f9c802c5436b0f8be041abd7484122458f7a05718f9f858b8bfed645396e11c9e89bfd37d367ce668c768
7
- data.tar.gz: 832416b20e2a4226c4af1a56486bceaa733b78a20dd489adcab7cdbdb182d0130edc65adb033e80f74b92bc9c68b2794f6c8355d94d158eefc9a5587a0b19c59
6
+ metadata.gz: 7f787de4b452df33ffc34b5c6a6d690219b6fc925142211ce80325070a7f11f2ab9dab606aa2ee0b08e095c59be6c159621a99e9c7075a686216785ba285d47b
7
+ data.tar.gz: d4a24f33704fce88710b846f00a91ec59b30004432af0281bc3d9889d03fd256ab4a7e8278f355125015ceb2371563e3bf45aa77c3932f4b059cefa0073b0313
@@ -56,7 +56,7 @@ class ELA.Collections.LimitedCollection extends Backbone.Collection
56
56
  removeFromHistory: (model) ->
57
57
  while @inHistory(model)
58
58
  @history.splice(@history.indexOf(model), 1)
59
- @trigger('historyChange')
59
+ @trigger('historyRemove')
60
60
 
61
61
  # Rebuilds history leaving old history entries untouched. Entries
62
62
  # are being added in collection order.
@@ -66,7 +66,7 @@ class ELA.Collections.LimitedCollection extends Backbone.Collection
66
66
  @each (model) =>
67
67
  @manageHistory(model, silent: true)
68
68
  unless _.isEqual(oldHistory, @history)
69
- @trigger('historyChange')
69
+ @trigger('historyReset')
70
70
 
71
71
  # Whenever a model is changing its `activeState` the history is
72
72
  # checked. If the model is `activated` and the history is at its
@@ -79,7 +79,7 @@ class ELA.Collections.LimitedCollection extends Backbone.Collection
79
79
  while @atLimit()
80
80
  @history.shift().set(@attribute, not @activeState)
81
81
  @history.push(model)
82
- @trigger('historyChange') unless options.silent
82
+ @trigger('historyAdd') unless options.silent
83
83
  else
84
84
  @removeFromHistory(model)
85
85
  this
@@ -45,12 +45,31 @@ class ELA.Models.GraphParams extends ELA.Models.CanvasParams
45
45
  @on('change:yScale', @calculateRanges)
46
46
 
47
47
  @calculateRanges()
48
+ @ensureCurveForAxisLabeling(initialCall: true)
48
49
  @bindCalculatorEvents()
49
50
  @listenTo(@app.curves, 'change:selected', @bindCalculatorEvents)
51
+ @listenTo(@app.curves, 'historyRemove historyReset', @ensureCurveForAxisLabeling)
52
+ @listenTo @app.curves, 'historyAdd', ->
53
+ @ensureCurveForAxisLabeling(reset: true)
50
54
  @listenTo @app, 'change:calculators', ->
51
55
  @calculateRanges()
52
56
  @bindCalculatorEvents()
53
57
 
58
+ ensureCurveForAxisLabeling: (options = {}) ->
59
+ currentAxisLabelingCurve = @get('axisLabelingForCurve')
60
+ curves = @filteredCurves()
61
+
62
+ if curves.indexOf(currentAxisLabelingCurve) < 0 or options.reset
63
+ if curves.length > 0
64
+ newLabelCurve = if options.initialCall
65
+ # First curve in legend
66
+ curves[0]
67
+ else
68
+ # Curve that has been selected recently (last curve in legend)
69
+ curves[curves.length - 1]
70
+
71
+ @set(axisLabelingForCurve: newLabelCurve)
72
+
54
73
  bindCalculatorEvents: ->
55
74
  # Remove current callbacks, add new ones for each curve
56
75
  @stopListening(@app.previous('calculators'))
@@ -65,6 +84,8 @@ class ELA.Models.GraphParams extends ELA.Models.CanvasParams
65
84
  @listenTo(calc, 'change:maxY change:yRange', @calculateRangeY)
66
85
  # TODO: Add dynamic dependencies to calculator, so that we can
67
86
  # actually only listen to maxY changes and recalculate ranges.
87
+ # TODO: is this block required?! change:xRange and change:yRange
88
+ # above should be enough.
68
89
  oldestCurve = filteredCurves[0]
69
90
  if oldestCurve?
70
91
  @listenTo(calc,
@@ -41,12 +41,7 @@ class ELA.Views.GraphView extends ELA.Views.ViewportView
41
41
  orientation: 'horizontal'
42
42
  attribute: @leftAxisHandler.attribute
43
43
 
44
- if options.graph?.curves?
45
- @curves = options.graph.curves.slice()
46
- @axisLabelingForCurve = @model.curves.find (curve) =>
47
- curve.get('function') is @curves[0]
48
- else
49
- @axisLabelingForCurve = @model.curves.first()
44
+ @curves = options.graph.curves.slice() if options.graph?.curves?
50
45
 
51
46
  if options.graph?.view
52
47
  @GraphView = options.graph.view.toFunction()
@@ -55,7 +50,6 @@ class ELA.Views.GraphView extends ELA.Views.ViewportView
55
50
  @displayParams = @model.displayParams[options.name] ?= new @GraphView.Params
56
51
  guides: @guides
57
52
  curves: @curves
58
- axisLabelingForCurve: @axisLabelingForCurve
59
53
  xAxisY: @xAxisY
60
54
  xAxisScale: @xAxisScale
61
55
  yAxisX: @yAxisX
@@ -1,3 +1,3 @@
1
1
  module ELA
2
- VERSION = '4.1.5'
2
+ VERSION = '4.1.6'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ela
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.1.5
4
+ version: 4.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Franz Kißig
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-01-17 00:00:00.000000000 Z
11
+ date: 2019-02-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler