Gitlab CSE Unil

Commit 6ac3fb35 authored by M. Chardon's avatar M. Chardon
Browse files

remplissage des rectgeo

parent d74066cb
......@@ -23,7 +23,9 @@ define(["paper", "tools/Shape.class","adim/category"], function (paper, Shape, C
var defaultProperties = {
comment: "",
//labelComment: "",
category: "cat_geo_1"
category: "cat_geo_1",
remplissage: 1,
fill:true
};
var hitOptions = {
......@@ -105,6 +107,8 @@ define(["paper", "tools/Shape.class","adim/category"], function (paper, Shape, C
//setFill: _noop,
//setStrokeWidth: _setStrokeWidth,
//getStrokeWidth: _getStrokeWidth,
getColorBgD: _getColorBgD
};
// Add event listeners
......@@ -119,10 +123,13 @@ define(["paper", "tools/Shape.class","adim/category"], function (paper, Shape, C
newRecGeo.onPropertyChange = itemPropertyChange;
newRecGeo.style = {
fillColor: _getColorBg(properties.category),
strokeColor: _getColor(properties.category),
strokeWidth: 25
};
if (properties.fill)
newRecGeo.style = {
fillColor: _getColorBg(properties.category),
};
newRecGeo._boundsSelected = true;
return newRecGeo;
......@@ -158,18 +165,24 @@ define(["paper", "tools/Shape.class","adim/category"], function (paper, Shape, C
prop = /*prop ||*/ {};
if (rectgeo.data) {
var category = rectgeo.data.prop.category || 'default';
var remplissage = rectgeo.data.prop.remplissage || 1;
var fill = rectgeo.data.prop.fill || "checked";
} else {
var category = 'default';
var remplissage = 1;
var fill = "checked";
}
var cat = Category.getCategory(category);
var color = cat && cat.color ||"grey";
var colorbg = cat && cat.colorbg ||"grey";
if (!_drawingLine) {
_drawingLine = new paper.Path.Rectangle(_startPoint,event.point); //Shape("rectangle", _events); //new paper.Path.Line({from: _startPoint, to: event.point});
_drawingLine.fillColor=colorbg;
_drawingLine = new paper.Path.Rectangle(_startPoint, event.point); //Shape("rectangle", _events); //new paper.Path.Line({from: _startPoint, to: event.point});
if (fill == "checked") {
drawingLine.fillColor = colorbg;
}
_drawingLine.color=color;
}
else {
_drawingLine.segments[1].point.x = event.point.x;
......@@ -488,6 +501,12 @@ define(["paper", "tools/Shape.class","adim/category"], function (paper, Shape, C
return color;
}
function _getColorBgD() {
var category = Category.getCategory(this.prop.category),
color = (category && category.colorbg) || "#000000";
return color;
}
// ----- Returned Module ------------------------------
_tool = new paper.Tool(toolDef);
......
......@@ -1435,7 +1435,13 @@ function($, _, Signal, paper, config, view, io, tools, attributes, Users, export
if (!filled) {
annot.fillColor = null; //transparentColor;
} else {
annot.fillColor = paper.project.currentStyle.fillColor;
var bcolor = paper.project.currentStyle.fillColor;
if (annot.data){
try {
bcolor = annot.data.getColorBgD();
} finally {}
}
annot.fillColor = bcolor;
}
paper.view.draw();
}
......@@ -1519,7 +1525,41 @@ function($, _, Signal, paper, config, view, io, tools, attributes, Users, export
var catBut = this.el.find(".btn-cat.active");
return catBut.length === 1 ? catBut.data('category') : "";
}
}
},
'remplissage': {
el: "#prop-annot-remplissage",
enable: function(status) {
status = (status !== void(0)) ? !!status : true;
//if (config.mode !== config.MODE_EDIT)
if ((config.mode === 'review') ||
(config.annotable && config.annotable.locked))
status = false;
if (status) {
this.el.removeAttr("disabled");
} else {
this.el.attr("disabled","disabled");
}
this.el.closest(".property-group").toggleClass("disabled", !status);
return this;
},
setValue: function(value) { this.el.val(value); return this; },
getValue: function() { return this.el.val(); },
init: function() {
var me = this;
var intervalId = null;
me.el.on('keyup', function(event) {
if (intervalId)
clearTimeout(intervalId);
intervalId = setTimeout(function(){
updateSelectedItemProp('remplissage');
intervalId = null;
}, 500);
});
}
},
};
......
......@@ -199,6 +199,11 @@
{% endwith %}
</div>
</div>
<div class="property-group fill-prop">
<label class="control-label"><small>Remplissage: &nbsp;</small>
<input id="fill-check" name="fill" type="checkbox">
</label>
</div>
<div class="property-group comment-prop">
<label class="control-label" for="prop-annot-comment"><small>Commentaire&hairsp;:</small></label>
<textarea class="form-control" id="prop-annot-comment" name="comment"></textarea>
......
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