Gitlab CSE Unil

Commit e8f21dfe authored by M. Chardon's avatar M. Chardon
Browse files

création geomo : affichage du dessin lors du déplacement de la souris

parent a17b3718
......@@ -91,6 +91,16 @@ module.exports = function(grunt) {
}
},
geomo_app: {
options: {
paths: {
env: "_build/adim/env/geomo"
},
name: "../js/geomo_app",
out: "../js/geomo_app" + jsOptimizedSuffix + ".js"
}
},
cimaf_analysis: {
options: {
paths: {
......
......@@ -164,45 +164,18 @@ define(["paper", "tools/Shape.class","adim/category"], function (paper, Shape, C
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=color;
//_drawingLine.style = striaStyle;
//_drawingLine.dashArray = [10, 5];
_drawingLine.fillColor=colorbg;
}
else {
//_drawingLine.segments[1].point = event.point;
_drawingLine.size = new paper.Size(event.point.x-_startPoint.x,event.point.y-_startPoint.y); //= new paper.Path.Rectangle(_startPoint,event.point);
//if (event.event.shiftKey)
// _horizontalize(_drawingLine, 1);
_drawingLine.segments[1].point.x = event.point.x;
_drawingLine.segments[2].point = event.point;
_drawingLine.segments[3].point.y = event.point.y;
}
//_drawingLine.opacity = validatePosition(_startPoint, event.point) ? 1 : 0.5;
//_drawingLine.dashArray = validatePosition(_startPoint, event.point) ? null : [10, 5];
/*
var circle = new paper.Path.Circle({
center: [0, 0],
strokeColor: color || "black",
fillColor: "white"
});
// The label
var labelText = new paper.PointText({
point: [0,0],
fillColor: color || "black",
strokeColor: null,
fontFamily: 'Courier',
fontWeight: 'bold'
});
var rec = new Shape("rectangle", _events);
//rectgeomarker.removeChildren();
//rectgeomarker.addChildren([rec]);*/
}
function _terminateCreate(event) {
......@@ -234,6 +207,13 @@ define(["paper", "tools/Shape.class","adim/category"], function (paper, Shape, C
_editedSegmentIdx = _editedStriaLeftIdx = _editedStriaRightIdx = _editedStria = _editedSegmentXLimit = null;
}
function cancelCreate() {
if (_drawingLine)
_drawingLine.remove();
_startPoint = null;
create = false;
}
/*function validatePosition(from, to){
// A concordant stria should cross the cut
......@@ -275,6 +255,7 @@ define(["paper", "tools/Shape.class","adim/category"], function (paper, Shape, C
},
onMouseDrag: function(event) {
console.info("onMouseDrag");
if (create && _startPoint) {
terminateOnRelease = true;
drawRecGeo(this,event);
......@@ -285,6 +266,7 @@ define(["paper", "tools/Shape.class","adim/category"], function (paper, Shape, C
},
onMouseMove: function(event) {
console.info("onMouseMove");
if (create && _startPoint) {
drawRecGeo(this,event);
}
......@@ -304,28 +286,28 @@ define(["paper", "tools/Shape.class","adim/category"], function (paper, Shape, C
_editedSegmentIdx = _editedRecGeo = null;
},
/*onKeyDown: function(event) {
onKeyDown: function(event) {
//console.log( event.key );
switch (event.key) {
case "enter":
/*case "enter":
if (create)
_terminateCreate();
break;
_terminateCreate(event);
break;*/
case "escape":
if (create)
cancelCreate();
break;
case "shift":
/*case "shift":
if (_drawingLine) {
_horizontalize(_drawingLine, 1);
} else if (_editedRecGeo && _editedSegmentIdx !== null) {
_horizontalize(_editedRecGeo, _editedSegmentIdx);
}
break;
break;*/
case "up":
/*case "up":
case"down":
var items = paper.project.getSelectedItems();
for (var i=0,item;item=items[i];i++){
......@@ -334,10 +316,10 @@ define(["paper", "tools/Shape.class","adim/category"], function (paper, Shape, C
break;
}
}
break;
break;*/
}
},*/
},
/*onKeyUp: function (event) {
//console.log( event.key );
......
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