Skip to content
This repository has been archived by the owner on Oct 26, 2021. It is now read-only.

Commit

Permalink
Style and logic for tall/short completion element
Browse files Browse the repository at this point in the history
  • Loading branch information
Andre Medeiros committed Oct 19, 2014
1 parent 5d7eaef commit 61a465a
Show file tree
Hide file tree
Showing 9 changed files with 64 additions and 20 deletions.
3 changes: 2 additions & 1 deletion TODO
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ DONE Update examples with regard to completion time
DONE New Model View Interpreter architecture, for OperatorsMenu
DONE New MVI architecture for Sandbox
DONE Rename interpreters to intents
TODO Style and logic for tall/short completion element
DONE Style and logic for tall/short completion element
TODO Delete old sandbox models, views and sub views
- models/input-diagrams
- models/output-diagram
Expand All @@ -63,6 +63,7 @@ TODO Delete old sandbox models, views and sub views
- rename views/new-sandbox
- Remove hyperscript everywhere
- Remove raw DOM manipulation
TODO Bug: slowly dragging should change marble time
TODO Bug: some marbles can't be dragged, error 'invalid parent' is shown
TODO Build scripts to replace gulp (?)
## v1.1.0
Expand Down
7 changes: 6 additions & 1 deletion dist/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,9 @@
}
.diagramCompletion-inner {
width: 2px;
height: 100%;
height: 50%;
margin-left: 7px;
margin-top: 11px;
background-color: #323232;
}
.diagramCompletion.is-draggable {
Expand All @@ -126,6 +127,10 @@
-moz-box-shadow: 0px 1px 2px 1px rgba(0, 0, 0, 0.17);
box-shadow: 0px 1px 2px 1px rgba(0, 0, 0, 0.17);
}
.diagramCompletion.is-tall .diagramCompletion-inner {
height: 100%;
margin-top: 0;
}
.marble {
width: 32px;
height: 32px;
Expand Down
20 changes: 15 additions & 5 deletions dist/js/app.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/js/binder.js

Large diffs are not rendered by default.

20 changes: 15 additions & 5 deletions dist/js/renderer.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/js/utils.js

Large diffs are not rendered by default.

14 changes: 12 additions & 2 deletions src/views/completion.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ var h = require('hyperscript');
var vh = require('virtual-hyperscript');
var Utils = require('rxmarbles/views/utils');

var MARBLE_WIDTH = 5; // estimate of a marble width, in percentages

function render(completionTime) {
var element = h('div.diagramCompletion.is-draggable.js-completion', {}, [
h('div.diagramCompletion-inner')
Expand All @@ -18,11 +20,19 @@ function render(completionTime) {
return element;
}

function vrender(completionData, isDraggable, mouseDown$) {
function vrender(completionData, isDraggable, diagramData, mouseDown$) {
if (typeof isDraggable === 'undefined') {
isDraggable = false;
}
return vh('div.diagramCompletion'+(isDraggable ? '.is-draggable' : ''), {
var isDraggableClass = (isDraggable) ? '.is-draggable' : '';
var isTall = false;
diagramData.forEach(function (marbleData) {
if (Math.abs(marbleData.time - completionData.time) <= MARBLE_WIDTH*0.5) {
isTall = true;
}
});
var isTallClass = (isTall) ? '.is-tall' : '';
return vh('div.diagramCompletion' + isDraggableClass + isTallClass, {
style: {'left': completionData.time + '%'},
attributes: {'data-diagram-id': completionData.diagramId},
'ev-mousedown': function(ev) { if (mouseDown$) { mouseDown$.onNext(ev); } }
Expand Down
2 changes: 1 addition & 1 deletion src/views/diagram.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function vrender(diagramData, isInteractive, marbleMouseDown$, completionMouseDo
});
var completionData = {time: diagramData.end, diagramId: diagramData.id};
var completionVTree = Completion.vrender(
completionData, isInteractive, completionMouseDown$
completionData, isInteractive, diagramData, completionMouseDown$
);
return h('div.diagram', {}, [
h('div.diagram-arrow'),
Expand Down
10 changes: 9 additions & 1 deletion styles/components/diagram/diagramCompletion.less
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@

.diagramCompletion-inner {
width: @diagram-arrow-thickness;
height: 100%;
height: 50%;
margin-left: (3.5*@diagram-arrow-thickness);
margin-top: (@diagram-completion-height / 4.0);
background-color: @diagram-arrow-color;
}

Expand All @@ -20,3 +21,10 @@
.m-z-depth-1();
}
}

.diagramCompletion.is-tall {
.diagramCompletion-inner {
height: 100%;
margin-top: 0;
}
}

0 comments on commit 61a465a

Please sign in to comment.