Commit 85731671 authored by Robin Tissot's avatar Robin Tissot
Browse files

Fixes creating region without type when splitting and unbinding of keyboard...

Fixes creating region without type when splitting and unbinding of keyboard when no region/line is selected and hiting T.
parent 2983b057
......@@ -65,7 +65,6 @@ const SegPanel = BasePanel.extend({
// same event for creation and modification of a line/region
let data = ev.detail;
this.extractPrevious(data);
let toCreate = {
lines: data.lines && data.lines.filter(l=>l.context.pk===null) || [],
regions: data.regions && data.regions.filter(l=>l.context.pk===null) || []
......@@ -85,7 +84,7 @@ const SegPanel = BasePanel.extend({
});
}.bind(this),
function() { // redo
this.bulkCreate(toCreate, createInEditor=true)
this.bulkCreate(toCreate, createInEditor=true);
this.bulkUpdate(toUpdate);
}.bind(this)
);
......@@ -209,7 +208,8 @@ const SegPanel = BasePanel.extend({
this.$parent.$emit(
'create:region', {
pk: data.regions[i].pk,
box: data.regions[i].box
box: data.regions[i].box,
type: data.regions[i].type
}, function(region) {
if (createInEditor) {
this.segmenter.loadRegion(region);
......
......@@ -339,8 +339,10 @@ const partStore = {
createRegion(region, callback) {
let uri = this.getApiPart() + 'blocks/';
let type = region.type && this.types.regions.find(t=>t.name==region.type);
data = {
document_part: this.pk,
typology: type && type.pk || null,
box: region.box
};
this.push(uri, data, method="post")
......
......@@ -1701,6 +1701,9 @@ class Segmenter {
} else {
this.regionTypesSelect.value = 'None';
}
} else {
// avoid unbinding keyboard then
return;
}
var self = this; // mandatory for unbinding
......@@ -1999,7 +2002,8 @@ class Segmenter {
region.polygonPath.removeSegments();
coumpound.children[0].segments.forEach(s=>region.polygonPath.add(s));
for (let i=1;i<coumpound.children.length;i++) {
let newRegion = this.createRegion(null, coumpound.children[i].segments, region.type, null, false);
let newRegion = this.createRegion(null, coumpound.children[i].segments,
region.type, null, false);
newRegion.updateDataFromCanvas();
coumpound.children[i].remove();
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment