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 ...@@ -23,7 +23,9 @@ define(["paper", "tools/Shape.class","adim/category"], function (paper, Shape, C
var defaultProperties = { var defaultProperties = {
comment: "", comment: "",
//labelComment: "", //labelComment: "",
category: "cat_geo_1" category: "cat_geo_1",
remplissage: 1,
fill:true
}; };
var hitOptions = { var hitOptions = {
...@@ -105,6 +107,8 @@ define(["paper", "tools/Shape.class","adim/category"], function (paper, Shape, C ...@@ -105,6 +107,8 @@ define(["paper", "tools/Shape.class","adim/category"], function (paper, Shape, C
//setFill: _noop, //setFill: _noop,
//setStrokeWidth: _setStrokeWidth, //setStrokeWidth: _setStrokeWidth,
//getStrokeWidth: _getStrokeWidth, //getStrokeWidth: _getStrokeWidth,
getColorBgD: _getColorBgD
}; };
// Add event listeners // Add event listeners
...@@ -119,10 +123,13 @@ define(["paper", "tools/Shape.class","adim/category"], function (paper, Shape, C ...@@ -119,10 +123,13 @@ define(["paper", "tools/Shape.class","adim/category"], function (paper, Shape, C
newRecGeo.onPropertyChange = itemPropertyChange; newRecGeo.onPropertyChange = itemPropertyChange;
newRecGeo.style = { newRecGeo.style = {
fillColor: _getColorBg(properties.category),
strokeColor: _getColor(properties.category), strokeColor: _getColor(properties.category),
strokeWidth: 25 strokeWidth: 25
}; };
if (properties.fill)
newRecGeo.style = {
fillColor: _getColorBg(properties.category),
};
newRecGeo._boundsSelected = true; newRecGeo._boundsSelected = true;
return newRecGeo; return newRecGeo;
...@@ -158,18 +165,24 @@ define(["paper", "tools/Shape.class","adim/category"], function (paper, Shape, C ...@@ -158,18 +165,24 @@ define(["paper", "tools/Shape.class","adim/category"], function (paper, Shape, C
prop = /*prop ||*/ {}; prop = /*prop ||*/ {};
if (rectgeo.data) { if (rectgeo.data) {
var category = rectgeo.data.prop.category || 'default'; var category = rectgeo.data.prop.category || 'default';
var remplissage = rectgeo.data.prop.remplissage || 1;
var fill = rectgeo.data.prop.fill || "checked";
} else { } else {
var category = 'default'; var category = 'default';
var remplissage = 1;
var fill = "checked";
} }
var cat = Category.getCategory(category); var cat = Category.getCategory(category);
var color = cat && cat.color ||"grey"; var color = cat && cat.color ||"grey";
var colorbg = cat && cat.colorbg ||"grey"; var colorbg = cat && cat.colorbg ||"grey";
if (!_drawingLine) { if (!_drawingLine) {
_drawingLine = new paper.Path.Rectangle(_startPoint,event.point); //Shape("rectangle", _events); //new paper.Path.Line({from: _startPoint, to: event.point}); _drawingLine = new paper.Path.Rectangle(_startPoint, event.point); //Shape("rectangle", _events); //new paper.Path.Line({from: _startPoint, to: event.point});
_drawingLine.fillColor=colorbg; if (fill == "checked") {
drawingLine.fillColor = colorbg;
}
_drawingLine.color=color;
} }
else { else {
_drawingLine.segments[1].point.x = event.point.x; _drawingLine.segments[1].point.x = event.point.x;
...@@ -488,6 +501,12 @@ define(["paper", "tools/Shape.class","adim/category"], function (paper, Shape, C ...@@ -488,6 +501,12 @@ define(["paper", "tools/Shape.class","adim/category"], function (paper, Shape, C
return color; return color;
} }
function _getColorBgD() {
var category = Category.getCategory(this.prop.category),
color = (category && category.colorbg) || "#000000";
return color;
}
// ----- Returned Module ------------------------------ // ----- Returned Module ------------------------------
_tool = new paper.Tool(toolDef); _tool = new paper.Tool(toolDef);
......
...@@ -1435,7 +1435,13 @@ function($, _, Signal, paper, config, view, io, tools, attributes, Users, export ...@@ -1435,7 +1435,13 @@ function($, _, Signal, paper, config, view, io, tools, attributes, Users, export
if (!filled) { if (!filled) {
annot.fillColor = null; //transparentColor; annot.fillColor = null; //transparentColor;
} else { } 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(); paper.view.draw();
} }
...@@ -1519,7 +1525,41 @@ function($, _, Signal, paper, config, view, io, tools, attributes, Users, export ...@@ -1519,7 +1525,41 @@ function($, _, Signal, paper, config, view, io, tools, attributes, Users, export
var catBut = this.el.find(".btn-cat.active"); var catBut = this.el.find(".btn-cat.active");
return catBut.length === 1 ? catBut.data('category') : ""; 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 @@ ...@@ -199,6 +199,11 @@
{% endwith %} {% endwith %}
</div> </div>
</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"> <div class="property-group comment-prop">
<label class="control-label" for="prop-annot-comment"><small>Commentaire&hairsp;:</small></label> <label class="control-label" for="prop-annot-comment"><small>Commentaire&hairsp;:</small></label>
<textarea class="form-control" id="prop-annot-comment" name="comment"></textarea> <textarea class="form-control" id="prop-annot-comment" name="comment"></textarea>
......
Supports Markdown
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