Skip to content

Commit

Permalink
parentspan in gather_change (#3 subissue e)
Browse files Browse the repository at this point in the history
  • Loading branch information
proycon committed Nov 30, 2016
1 parent 230cace commit 350b829
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
2 changes: 1 addition & 1 deletion flat/style/flat.editor.css
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ div.confidenceeditor div {
text-align: center;
}

.spanparenteditor select {
.parentspaneditor select {
max-width: 400px;
overflow: crop;
}
16 changes: 13 additions & 3 deletions flat/style/flat.editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -503,8 +503,8 @@ function applysuggestion(e,i) {

function renderparentspanfield(index, annotation, nestableparents) {
//This is a nestable span element
var s = "<div class=\"spanparenteditor\">Parent span: " +
"<select name=\"spanparent" + index + "\">" +
var s = "<div class=\"parentspaneditor\">Parent span: " +
"<select name=\"parentspan" + index + "\">" +
"<option value=\"\">(none/root)</option>";
forspanannotations(annotation.layerparent, function(spanannotation){
for (var i = 0; i < nestableparents.length; i++) {
Expand Down Expand Up @@ -737,6 +737,11 @@ function showeditor(element) {
//default fallback
editdataitem.editform = 'direct';
}
if (annotation.parentspan) {
editdataitem.parentspan = annotation.parentspan;
} else if (nestablespan.length > 0) {
editdataitem.parentspan = null;
}

//Set the target elements for this annotation (it may concern more than the selected element after all)
editdataitem.targets_begin = JSON.parse(JSON.stringify(annotation.targets)); //there are two versions so we can compare if there was a change in span (deep copy, hence the json parse/stringify)
Expand Down Expand Up @@ -1233,10 +1238,15 @@ function gather_changes() {
editdata[i].class = $('#editfield' + i).val().trim();
}
if (((editdata[i].type == "t") || (editdata[i].type == "ph")) && ($('#editfield' + i + 'text') && ($('#editfield' + i + 'text').val() == editdata[i].text))) {
editdata[i].oldtext = editdata[i].text; //will remain requal
editdata[i].oldtext = editdata[i].text; //will remain equal
editdata[i].text = $('#editfield' + i + 'text').val().trim();
}
}
if ((editform[i].parentspan) && (editform[i].parentspan != $('#parentspan' + i).val())) {
editform[i].oldparentspan = editform[i].parentspan;
editdata[i].changed = true;
}

if ($('#confidencecheck' + i).is(':checked')) {
var confidence = $('#confidenceslider' + i).slider('value') / 100;
if ((confidence != editdata[i].confidence) && ((editdata[i].confidence == "NONE") || (Math.abs(editdata[i].confidence - confidence) >= 0.01))) { //compensate for lack of slider precision: very small changes do not count
Expand Down

0 comments on commit 350b829

Please sign in to comment.