Gitlab CSE Unil

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

maj lib javascript et Django

optimisation et debuggage ADIM avec sonar
parent ed0da126
......@@ -127,8 +127,12 @@ function () {
});
}
}
s.data.type = shapeType;
if (style) { s.set('style', style); }
if (s) {
s.data.type = shapeType;
if (style) {
s.set('style', style);
}
}
return s;
}
......@@ -235,7 +239,7 @@ function () {
}
function _setDragMode(mode, opts) {
if (! mode in DRAG_MODES) {
if (! (mode in DRAG_MODES)) {
_dragMode = null;
_dragOpts = {};
_dragModified = false;
......
......@@ -43,8 +43,6 @@ define(["paper"], function (paper) {
// ----- Serialization ---------------------------------
function exportJSON(param) {
var fromPt = this.data.from;
var toPt = this.data.to;
var json = this.exportJSON({asString:false});
......@@ -273,7 +271,7 @@ define(["paper"], function (paper) {
var _dragModified = false; // this is set to true if a drag event changed the item and need to emmit a change event
function setDragMode(mode, opts) {
if (! mode in DRAG_MODES) {
if (! (mode in DRAG_MODES)) {
_dragMode = null;
_dragOpts = {};
_dragModified = false;
......@@ -491,7 +489,6 @@ define(["paper"], function (paper) {
var toolDef = {
onMouseDown: function(event) {
if (_ro) return;
var hitAnnot;
_create = false;
_creatingArrow = null;
if (!_hitOnArrowTest(event.point)) {
......
......@@ -44,11 +44,8 @@ define(["paper", "tools/Shape.class","adim/category"], function (paper,Shape, Ca
// ----- Serialization ---------------------------------
function exportJSON(param) {
var fromPt = this.data.from;
var toPt = this.data.to;
var json = this.exportJSON({asString:false});
try {
json[1][1].data.from = [this.data.from.x, this.data.from.y];
json[1][1].data.to = [this.data.to.x, this.data.to.y];
......@@ -56,7 +53,6 @@ define(["paper", "tools/Shape.class","adim/category"], function (paper,Shape, Ca
console.error(e);
}
return (param && param.asString) ? JSON.stringify(json) : json;
}
......@@ -64,7 +60,6 @@ define(["paper", "tools/Shape.class","adim/category"], function (paper,Shape, Ca
function importJSON(itemDef, layer, listening) {
var item = itemDef[1][1];
var symbolItem = itemDef[0][1][item.symbol][1][1];
var isFill = symbolItem.fillColor && (symbolItem.fillColor.length < 3 || symbolItem.fillColor[3] !== 0);
var opacity = parseFloat(item.opacity) || 1;
var curLayer = paper.project.activeLayer;
......@@ -285,7 +280,7 @@ define(["paper", "tools/Shape.class","adim/category"], function (paper,Shape, Ca
var _dragModified = false; // this is set to true if a drag event changed the item and need to emmit a change event
function setDragMode(mode, opts) {
if (! mode in DRAG_MODES) {
if (! (mode in DRAG_MODES)) {
_dragMode = null;
_dragOpts = {};
_dragModified = false;
......@@ -528,7 +523,6 @@ define(["paper", "tools/Shape.class","adim/category"], function (paper,Shape, Ca
var toolDef = {
onMouseDown: function(event) {
if (_ro) return;
var hitAnnot;
_create = false;
_creatingArrow = null;
if (!_hitOnArrowTest(event.point)) {
......
......@@ -252,16 +252,18 @@ define(["paper"], function (paper) {
// Can be called
var dstPoint = _drawingArea ? _drawingArea.segments[3].point.clone() : null;
if (_drawingArea) {
_drawingArea.remove();
_drawingArea = null;
}
if (dstPoint) {
if (_drawingArea) {
_drawingArea.remove();
_drawingArea = null;
}
var newArea = createNewZone({from:_startPoint.y, to:dstPoint.y});
_events.annotationAdded.dispatch(newArea);
_areaChanged = false;
_startPoint = null;
create = false;
var newArea = createNewZone({from: _startPoint.y, to: dstPoint.y});
_events.annotationAdded.dispatch(newArea);
_areaChanged = false;
_startPoint = null;
create = false;
}
}
function drawArea(event) {
......
......@@ -240,7 +240,7 @@ define([
var circle = new paper.Path.Circle({
center: [0, 0],
radius: r,
strokeColor: color || "black",
strokeColor: color, //|| "black",
fillColor: "white",
strokeWidth: r / 4
});
......@@ -253,7 +253,7 @@ define([
[2*r - _d -r, _h - r]
],
closed: true,
fillColor: color || "black",
fillColor: color, // || "black",
strokeJoin: 'round',
strokeColor: highlight ? _markerMarginHiColor : _markerMarginColor,
strokeWidth: r / 8
......@@ -263,7 +263,7 @@ define([
var labelText = new paper.PointText({
point: [0,0],
content: label,
fillColor: color || "black",
fillColor: color, // || "black",
strokeColor: null,
fontFamily: 'Courier',
fontWeight: 'bold',
......@@ -352,7 +352,7 @@ define([
function setDragMode(mode, opts) {
if (! mode in DRAG_MODES) {
if (! (mode in DRAG_MODES)) {
_dragMode = null;
_dragOpts = {};
_dragModified = false;
......@@ -509,7 +509,6 @@ define([
var marker = hitOnMarkerTest(event.point);
if (marker) {
debugger;
if (!marker.selected) {
paper.project.deselectAll();
marker.selected = true;
......
......@@ -79,6 +79,9 @@ define([
var itemHitResult = item.hitTest(event.point, itemHitOptions);
_selectedSegment = _selectedMove = _selectedHandle = null;
_selectedShape = _selectedShapeBound = _selectedShapeResizeDir = _selectedArrowBound = null;
if (!itemHitResult){
return;
}
switch (itemHitResult.type) {
case 'handle-in':
case 'handle-out':
......
......@@ -65,7 +65,7 @@ define(["paper", "jquery"], function (paper, $) {
var _dragOpts = {};
var _dragModified = false; // this is set to true if a drag event changed the item and need to emmit a change event
function setDragMode(mode, opts) {
if (! mode in DRAG_MODES) {
if (! (mode in DRAG_MODES)) {
_dragMode = null;
_dragOpts = {};
_dragModified = false;
......
......@@ -72,7 +72,7 @@ define(["paper", "jquery","adim/category"], function (paper, $, Category) {
var _dragOpts = {};
var _dragModified = false; // this is set to true if a drag event changed the item and need to emmit a change event
function setDragMode(mode, opts) {
if (! mode in DRAG_MODES) {
if (! (mode in DRAG_MODES)) {
_dragMode = null;
_dragOpts = {};
_dragModified = false;
......
......@@ -51,6 +51,7 @@ function($, _, Signal, paper, config, view, io, tools, attributes, Users, export
var _canvas = null;
var _canvasCtnr = null;
var _canvasToolBar = null;
var _canvasCol = null;
var _sideCol = null;
var _toolsCol = null;
......@@ -680,7 +681,7 @@ function($, _, Signal, paper, config, view, io, tools, attributes, Users, export
var navTabs = $(".adim-view-mod-tabs"),
modHash = document.location.hash.split(':')[0],
docHash = "",// the final document hash as recalculated after validations
modTabA, modTabLi;
modTabA;
// There is no view-mod-tabs if the anobj has no shared annotations accessible,
// in this case, abort now
if (navTabs.length === 0)
......@@ -1652,11 +1653,11 @@ function($, _, Signal, paper, config, view, io, tools, attributes, Users, export
case 49:
case 50:
case 51:
if (false && focus.length === 0 && view.getSelectedAnnotations().length === 1) {
/*if (false && focus.length === 0 && view.getSelectedAnnotations().length === 1) {
var c = parseInt(event.which - 48, 10);
itemProperties.confidence.setValue(c);
itemProperties.confidence.el.change();
}
}*/
break;
}
});
......@@ -1774,12 +1775,11 @@ function($, _, Signal, paper, config, view, io, tools, attributes, Users, export
var curItemImg = this._anObjMgrModal.find(".aom-list-item.current img");
if (!curItemImg || curItemImg.length === 0) return;
if (!thumbnailPath || thumbnailPath === "") {
thumbnailPath = eval(
'(function(){' +
'function url(u){return u}' +
'return '+curItemImg.css("backgroundImage")+
'})()')
.split('?')[0];
var regexp = /url\(\"(.+)\"\)/g;
var resultRegexp = regexp.exec(curItemImg.css("backgroundImage"));
if (resultRegexp){
thumbnailPath = resultRegexp[1].split('?')[0];
}
}
curItemImg.css("backgroundImage",
'url("' + thumbnailPath + "?nc=_"+(""+Math.random()).substr(3) + '")'
......
......@@ -45,7 +45,7 @@ function($, _, Bloodhound, config){
}
function addUsers(users) {
if ($.isArray(users) && users.length >= 0)
if ($.isArray(users))
engine.add(users);
}
......
......@@ -62,7 +62,7 @@ function($, _, Backbone){
this.$el.closest("#aom-modal").modal("hide");
setTimeout((function(me){
document.location.assign(me.$el.find("a").attr("href"));
})(this), 200);
}), 200, this);
}
this.model.collection.trigger("select", this.$el, this.model);
}
......
......@@ -14,22 +14,22 @@
"bower_components"
],
"dependencies": {
"FileSaver": "~1.3.4",
"FileSaver": "1.3.4",
"backbone": "~1.3.3",
"bootstrap": "~4.0.0",
"bootstrap-colorpicker": "~2.5.1",
"bootstrap": "~4.1.1",
"bootstrap-colorpicker": "~2.5.2",
"bootstrap3-typeahead": "https://github.com/bassjobsen/Bootstrap-3-Typeahead.git#master",
"fontawesome": "~5.0.8",
"fontawesome": "~5.0.13",
"jquery": "",
"jquery-file-upload": "~9.21.0",
"jquery-mousewheel": "~3.1.11",
"jquery.autoGrowInput": "~0.0.2",
"jquery.hotkeys": "git://github.com/jeresig/jquery.hotkeys.git#~0.2.0",
"paper": "~0.11.5",
"popper.js": "~1.12.9",
"popper.js": "~1.14.3",
"requirejs": "",
"requirejs-i18n": "",
"seiyria-bootstrap-slider": "~10.0.0",
"seiyria-bootstrap-slider": "~10.0.2",
"signals": "~1.0.0",
"sortablejs": "~1.6.0",
"typeahead.js": "~0.11.1"
......
......@@ -11,8 +11,8 @@
"email": "Julien.Furrer@unil.ch"
},
{
"name": "Marion Chardon",
"email": "Marion.Chardon@unil.ch"
"name": "Marion Chardon",
"email": "Marion.Chardon@unil.ch"
}
],
"license": "GPLv3",
......
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