Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tweaked some visual styles for box rendering (Fixes #4) #10

Merged
merged 1 commit into from
Dec 2, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion src/app/annotationViewer/_annotation_viewer.scss
Original file line number Diff line number Diff line change
Expand Up @@ -33,20 +33,30 @@ baw-annotation-viewer {
line-height: $standard-line-height;

li {
border-bottom: $tagAlignmentLine solid 1px;

margin-left: -4px;
position: absolute;
bottom: -1px;
padding-left: 2px;
z-index: 0;
background-color: transparent;

@include vendor-prefix(transform-origin, 0 0);
@include vendor-prefix(transform, rotate3d(0,0,1,-20deg));



}
}

}

& .active {
z-index: 100;
background-color: #ffffff;
border-bottom: $tagAlignmentLine solid 1px;
}


& #scroller{
overflow-x: scroll;
Expand Down Expand Up @@ -109,6 +119,7 @@ baw-annotation-viewer {
position: absolute;
background-color: rgba(255,255,255,0.05);
overflow: visible;
z-index: 0;

&:before {
@if not $DEBUG {
Expand All @@ -128,10 +139,15 @@ baw-annotation-viewer {
&[data-selected="true"] {
border-color: $marqueeBorderColorSelected;
@include glow($marqueeBorderColorSelectedGlow);
z-index: 100;

& .close-icon{
visibility: visible;
}

&:before {
visibility: visible;
}
}

&:hover {
Expand Down
1 change: 1 addition & 0 deletions src/app/annotationViewer/annotationViewer.tpl.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<div class="tag-preview">
<ul>
<li ng-repeat="annotation in model.audioEvents"
ng-class="{active: annotation.selected || annotation.hovering}"
ng-style="{left: (positionLabel(annotation)) + 'px' }"
ng-eval="tag = getTag(annotation)"
>
Expand Down
15 changes: 14 additions & 1 deletion src/common/jquery.drawabox.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
(function ($) {

var SELECTED_ATTRIBUTE = "data-selected";
var HOVER_ATTRIBUTE = "data-hover";

var clickLocation = function (e) {
var posx = 0;
Expand Down Expand Up @@ -159,6 +160,16 @@
default : $newBox.click(raiseSelectCallback); break;
}

function onHover(event) {
var hovering = event.type === "mouseover" ||
event.type === "mouseenter";
var $t = $(this);
$t.attr(HOVER_ATTRIBUTE, hovering);
contextData.options.boxSelected($t);
}

$newBox.hover(onHover);

if (contextData.options.showOnly !== true) {
// add delete click handler
$('#' + newId + ' span').click(function () {
Expand Down Expand Up @@ -279,14 +290,16 @@

var getBox = function ($element) {
var selectedAttr = $element.attr(SELECTED_ATTRIBUTE);
var hoveringAttr = $element.attr(HOVER_ATTRIBUTE);

return {
id: parseInt($element.attr(dataIdKey), 10),
left: removePx($element.css("left")),
top: removePx($element.css("top")),
width: removePx($element.css("width")) + BORDER_MODEL_DIFFERANCE, // box model - border not included in widths
height: removePx($element.css("height")) + BORDER_MODEL_DIFFERANCE, // box model - border not included in widths
selected: (!!selectedAttr) && selectedAttr == "true"
selected: (!!selectedAttr) && selectedAttr == "true",
hovering: (!!hoveringAttr) && hoveringAttr == "true"
};
};

Expand Down
8 changes: 5 additions & 3 deletions src/components/directives/bawAnnotationViewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,9 +199,10 @@ bawds.directive('bawAnnotationViewer', [ 'conf.paths', 'AudioEvent', 'Tag', func
console.debug("AnnotationEditor:drawaboxUpdatesModel:", action);

// invariants
if (action === DRAWABOX_ACTION_SELECT && box.selected !== true) {
throw "AnnotationEditor:drawaboxUpdatesModel: Invariant failed for selection action";
}
// no longer true for hover state
// if (action === DRAWABOX_ACTION_SELECT && (box.selected !== true || box.hovering !== true)) {
// throw "AnnotationEditor:drawaboxUpdatesModel: Invariant failed for selection action";
// }
if (action !== DRAWABOX_ACTION_SELECT && action !== DRAWABOX_ACTION_CREATE && box.selected !== annotation.selected) {
throw "AnnotationEditor:drawaboxUpdatesModel: Invariant failed for non-selection action";
}
Expand Down Expand Up @@ -237,6 +238,7 @@ bawds.directive('bawAnnotationViewer', [ 'conf.paths', 'AudioEvent', 'Tag', func
});

annotation.selected = box.selected;
annotation.hovering = box.hovering;
}
else {
// resize / move
Expand Down
1 change: 1 addition & 0 deletions src/components/models/annotation.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ baw.Annotation = (function () {
this._epsilsonDirty = 0.0;
this.isDirty = false;
this.selected = false;
this.hovering = false;
this.taggings = [];
this.tags = [];

Expand Down