Skip to content

Commit

Permalink
add phrases to arr visual
Browse files Browse the repository at this point in the history
  • Loading branch information
wolfbiter committed Oct 22, 2016
1 parent 65907d8 commit 1c8bdde
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
7 changes: 7 additions & 0 deletions app/components/arrangement-visual.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export default DataVisual.extend(
// optional params
followPlayhead: false,
showBarGrid: true,
showPhaseGrid: true,
isReady: true,
showLastPlayMarker: false,
zoom: Ember.computed(() => d3.behavior.zoom()),
Expand Down Expand Up @@ -117,6 +118,12 @@ export default DataVisual.extend(
return d3.scale.linear().domain([0, domainMax + 0]).range([this.get('minX'), this.get('maxX')]);
}).readOnly(),

phraseScale: Ember.computed('arrangement.barCount', 'minX', 'maxX', function () {
let domainMax = this.get('arrangement.barCount') / 8;

return d3.scale.linear().domain([0, domainMax + 0]).range([this.get('minX'), this.get('maxX')]);
}).readOnly(),

_didZoom: _.throttle(function() {
const { zoom, minX, maxX, minY, maxY } = this.getProperties('zoom', 'minX', 'maxX', 'minY', 'maxY');
const translate = zoom.translate();
Expand Down
8 changes: 6 additions & 2 deletions app/styles/components/_arrangement-visual.scss
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
stroke: rgba(#0000ff, 1);
}

.ArrangementVisual-beatAxis, .ArrangementVisual-barAxis {
.ArrangementVisual-beatAxis, .ArrangementVisual-barAxis, .ArrangementVisual-phraseAxis {
height: 30px;
color: white;
stroke: white;
Expand All @@ -45,5 +45,9 @@
}

.ArrangementVisual-barAxis {
stroke: rgba(#fff, 0.3);
stroke: rgba(#fff, 0.2);
}

.ArrangementVisual-phraseAxis {
stroke: rgba(#fff, 1.0);
}
10 changes: 10 additions & 0 deletions app/templates/components/arrangement-visual.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,16 @@
tickSize=height
}}

{{d3-axis
isD3Visible=showPhaseGrid
select=select.ArrangementVisual-phraseAxis
transform=(svg-translate 0 height)
scale=phraseScale
orient="top"
ticks=(multiply arrangement.barCount 0.125)
tickSize=height
}}

{{yield select maxX maxY}}

{{arrangement-visual/playhead
Expand Down

0 comments on commit 1c8bdde

Please sign in to comment.