Gitlab CSE Unil

Commit 8e3c002d authored by M. Chardon's avatar M. Chardon
Browse files

correction anomalie des lignes qui restent affichées alors qu'elles n'ont pas...

correction anomalie des lignes qui restent affichées alors qu'elles n'ont pas été prises en compte +1
parent 5bc743d8
......@@ -62,7 +62,8 @@ function(_, Signal){
activated: new Signal(),
annotationAdded: new Signal(),
annotationChanged: new Signal(),
annotationSelected: new Signal()
annotationSelected: new Signal(),
annotationCheckCancel: new Signal()
};
......
......@@ -23154,7 +23154,8 @@ function(_, Signal){
activated: new Signal(),
annotationAdded: new Signal(),
annotationChanged: new Signal(),
annotationSelected: new Signal()
annotationSelected: new Signal(),
annotationCheckCancel: new Signal()
};
 
 
......@@ -23154,7 +23154,8 @@ function(_, Signal){
activated: new Signal(),
annotationAdded: new Signal(),
annotationChanged: new Signal(),
annotationSelected: new Signal()
annotationSelected: new Signal(),
annotationCheckCancel: new Signal()
};
 
 
......@@ -23154,7 +23154,8 @@ function(_, Signal){
activated: new Signal(),
annotationAdded: new Signal(),
annotationChanged: new Signal(),
annotationSelected: new Signal()
annotationSelected: new Signal(),
annotationCheckCancel: new Signal()
};
 
 
......@@ -23154,7 +23154,8 @@ function(_, Signal){
activated: new Signal(),
annotationAdded: new Signal(),
annotationChanged: new Signal(),
annotationSelected: new Signal()
annotationSelected: new Signal(),
annotationCheckCancel: new Signal()
};
 
 
......@@ -15901,7 +15901,7 @@ define('tools/arrowgeo',["paper","tools/Shape.class","adim/category"],function(a
/*! AdIm - v0.0.0 - 2018-03-05 - Copyright (C) 2018 Université de Lausanne - see licence */
define('tools/textgeo',["paper","jquery","adim/category"],function(a,b,c){function d(a,b){!a in D?(E=null,F={},G=!1):(E=D[a],F=b)}function e(a){switch(E){case D.DRAG_HANDLE:if("center"===F.nameParts[1])return;var b=F.item.bounds,c="top"===F.nameParts[0]?b.bottom-a.point.y:a.point.y-b.top,d=c/1.2,e=[0,0];"bottom"===F.nameParts[0]&&(e[1]=c-b.height),d>9&&d<999&&j.call(F.item,d),F.item.translate(e);break;case D.FULL_DRAG:default:this.translate(a.delta)}}function f(a){a.data.prop="object"==typeof a.data.prop?a.data.prop:{};for(var b in A)a.data.prop.hasOwnProperty(b)||(a.data.prop[b]=A[b]);a.oGetSelected=function(){return this.children[1].selected},a.oSetSelected=function(a){this.children[1].selected=a},a.data.setDragMode=d,a.data.itemMouseDrag=e}function g(c){if(u&&h(!1),!y){u=!0,w||(w=b("<input>",{type:"text",class:"text-tool-input",placeholder:"Votre texte",maxlength:128,size:128,style:"display:none;position:absolute;top:0;left:0;padding:10px;border:0;border-radius:5px;background:rgba(255,255,255,0.75);"}).appendTo(a.project.view.element.parentNode).on("blur",function(){u&&h()}).on("keydown",function(a){27!==a.which&&13!=a.which||h()}).autoGrowInput(),x=x||b("<div>").css({zIndex:999,position:"fixed",display:"none",top:"-10px",left:"-10px",width:"5000px",height:"5000px"}).click(function(){h()}),w.before(x)),c.selected=!1,c.visible=!1;var d=c.children[1].point;d=d.subtract(a.view.bounds.point).multiply(a.view.zoom);var e=c.fontSize*a.view.zoom;c.data.color=m(B.category),w.val(c.data.content).css({fontSize:e+"px",fontFamily:c.font,color:c.data.color,top:d.y-e+1-10,left:d.x-1-10,zIndex:1e3}).show(),x.show();var f=w.nextAll("tester");f.css({fontSize:w.css("fontSize"),fontFamily:w.css("fontFamily"),fontWeight:w.css("fontWeight"),letterSpacing:w.css("letterSpacing")}),f.text(""===c.data.content?w.attr("placeholder"):c.data.content),w.width(f.width()+30),v=c,setTimeout(function(){w.focus()},100)}}function h(b){if(b=!(b===!1),u=!1,v){var c=w.val();if(c&&""!==c){var d=""===v.data.content;v.data.content=c,v.children[0].content=c,v.children[1].content=c,v.visible=!0,v.onPropertyChange=s,b&&z.annotationSelected&&"function"==typeof z.annotationSelected.dispatch&&z.annotationSelected.dispatch(v),d?(f(v),z.annotationAdded&&"function"==typeof z.annotationAdded.dispatch&&z.annotationAdded.dispatch(v),v.selected=!0,z.annotationSelected.dispatch(v)):z.annotationChanged&&"function"==typeof z.annotationChanged.dispatch&&z.annotationChanged.dispatch(v),v.oSetSelected(b),a.project.view.draw()}else v.remove(),v=null}return x.hide(),w.val("").blur().hide(),v}function i(a){var b=this,c=b.children[1].fillColor!==a;return b.children[1].fillColor=a,b.data.color=a,c}function j(a){var b=this,c=a/10;c<3&&(c=3),b.children[0].fontSize=a,b.children[0].strokeWidth=c,b.children[1].fontSize=a}function k(){return this.children[0].fontSize}function l(a){B.category=a}function m(a){var b=c.getCategory(a),d=b&&b.color||"#000000";return d}function n(a){var b=c.getCategory(a),d=b&&b.colorbg||"#000000";return d}function o(){if(this.prop){var a=c.getCategory(this.prop.category),b=a&&a.colorbg||"#000000";return b}return"#000000"}function p(a,c,d){var e=c.importJSON(a),h=e.data.prop;for(var p in B)h.hasOwnProperty(p)||(h[p]=B[p]);return b.extend(e.data,{setColor:i,setFill:C,setStrokeWidth:C,setFontSize:j,getFontSize:k,prop:h,setCategory:l,getColorBgD:o}),e.onPropertyChange=s,e.data.color=m(e.data.prop.category),e.style={strokeColor:n(e.data.prop.category),fillColor:m(e.data.prop.category)},f(e),d&&e.children[1].on("doubleclick",function(){g(this.parent)}),e}function q(a){var c=this.selected;this.selected=!1;var d=this.exportJSON({asString:!1});return b.each(d[1].children,function(a,b){delete b[1].leading}),d=a&&a.asString===!1?d:JSON.stringify(d),c&&(this.selected=c),d}function r(a){return a!==y&&(y=a),y}function s(b,c){"category"===b&&(l.call(this,c),this.style={fillColor:m(c),strokeColor:n(c)},a.view.draw())}var t="textgeo",u=!1,v=null,w=null,x=null,y=!1,z={annotationAdded:null,annotationChanged:null,annotationSelected:null},A={type:"point-text",comment:"",tolerance:5,fill:!0},B={comment:"",category:"cat_geo_1",fill:!0},C=function(){},D={FULL_DRAG:1,DRAG_HANDLE:4},E=null,F={},G=!1,H={onMouseDown:function(b){if(!y){var c=a.project.activeLayer.hitTest(b.point,A);if(c){var d=c.item.parent;g(d)}else{var e=a.project.currentStyle.fontSize;if(u)h();else{a.project.deselectAll();var f=b.point,m=new a.PointText({point:f,fillColor:"white",strokeColor:"white",strokeWidth:e/6,strokeJoin:"round",content:""}),n=a.project.currentStyle.strokeColor||a.project.currentStyle.fillColor;n=n.toCSS();var p=new a.PointText({point:f,fillColor:n,strokeColor:n,strokeWidth:0,content:""});p.on("doubleclick",function(){g(this.parent)});var q={};for(var r in B)q.hasOwnProperty(r)||(q[r]=B[r]);v=new a.Group({children:[m,p],data:{type:t,setColor:i,setFill:C,setStrokeWidth:C,setFontSize:j,getFontSize:k,prop:q,setCategory:l,getColorBgD:o,content:"",color:n}}),v.data.tId="a"+v._id,v.data.content="",g(v)}}}}};return{name:t,tool:new a.Tool(H),setRo:r,exportJSON:q,importJSON:p,registerEvent:function(a,b){z[a]=b}}});
/*! AdIm - v0.0.0 - 2018-03-05 - Copyright (C) 2018 Université de Lausanne - see licence */
define('adim/tools',["underscore","signals","tools/select","tools/pan","tools/drawing","tools/lines","tools/ellipse","tools/rectangle","tools/text","tools/arrow","tools/fieldedges","tools/concordantstr","tools/discordantstr","tools/cmsarea","tools/marker","tools/drawinggeo","tools/linesgeo","tools/ellipsegeo","tools/rectanglegeo","tools/arrowgeo","tools/textgeo"],function(a,b){function c(a,b){return b.importJSON(a)}function d(a){return this.exportJSON(a)}function e(){return n}function f(a){return m[a]?m[a].tool:null}function g(a){if(a&&m[a]){var b=f(n);b&&q.annotationCheckCancel.dispatch(b);var c=f(a);c?(n=a,c.activate(),q.activated.dispatch(a)):console&&console.warn&&console.warn("Tool «"+a+"» not activated")}}function h(a){return m[a]&&"function"==typeof m[a].importJSON?m[a].importJSON:p}function i(a){return m[a]&&"function"==typeof m[a].exportJSON?m[a].exportJSON:p}function j(a,b){var c=i(a.data.type);return c.call(a,$.extend({asString:!0},b))}function k(b){b!==o&&(o=b,a.invoke(m,"setRo",b))}for(var l,m={},n=null,o=null,p=function(){},q={activated:new b,annotationAdded:new b,annotationChanged:new b,annotationSelected:new b},r=1;l=arguments[r];r++)m[l.name]={tool:l.tool,importJSON:l.importJSON||c,exportJSON:l.exportJSON||d,setRo:l.setRo||p,listeners:l.listeners||{},events:l.events||{}},"function"==typeof l.registerEvent&&(l.registerEvent("annotationAdded",q.annotationAdded),l.registerEvent("annotationChanged",q.annotationChanged),l.registerEvent("annotationSelected",q.annotationSelected)),l.listeners&&"function"==typeof l.listeners.onToolActivated&&q.activated.add(l.listeners.onToolActivated);return function(){var a=new paper.Tool({onMouseDown:p,onMouseUp:p,onMouseDrag:p,onKeyDown:p,onKeyUp:p});a.activate()}(),{events:q,tools:m,getTool:f,getToolJSONImporter:h,getToolJSONExporter:i,activateTool:g,getActiveTool:e,serializeItem:j,setRo:k}});
define('adim/tools',["underscore","signals","tools/select","tools/pan","tools/drawing","tools/lines","tools/ellipse","tools/rectangle","tools/text","tools/arrow","tools/fieldedges","tools/concordantstr","tools/discordantstr","tools/cmsarea","tools/marker","tools/drawinggeo","tools/linesgeo","tools/ellipsegeo","tools/rectanglegeo","tools/arrowgeo","tools/textgeo"],function(a,b){function c(a,b){return b.importJSON(a)}function d(a){return this.exportJSON(a)}function e(){return n}function f(a){return m[a]?m[a].tool:null}function g(a){if(a&&m[a]){var b=f(n);b&&q.annotationCheckCancel.dispatch(b);var c=f(a);c?(n=a,c.activate(),q.activated.dispatch(a)):console&&console.warn&&console.warn("Tool «"+a+"» not activated")}}function h(a){return m[a]&&"function"==typeof m[a].importJSON?m[a].importJSON:p}function i(a){return m[a]&&"function"==typeof m[a].exportJSON?m[a].exportJSON:p}function j(a,b){var c=i(a.data.type);return c.call(a,$.extend({asString:!0},b))}function k(b){b!==o&&(o=b,a.invoke(m,"setRo",b))}for(var l,m={},n=null,o=null,p=function(){},q={activated:new b,annotationAdded:new b,annotationChanged:new b,annotationSelected:new b,annotationCheckCancel:new b},r=1;l=arguments[r];r++)m[l.name]={tool:l.tool,importJSON:l.importJSON||c,exportJSON:l.exportJSON||d,setRo:l.setRo||p,listeners:l.listeners||{},events:l.events||{}},"function"==typeof l.registerEvent&&(l.registerEvent("annotationAdded",q.annotationAdded),l.registerEvent("annotationChanged",q.annotationChanged),l.registerEvent("annotationSelected",q.annotationSelected)),l.listeners&&"function"==typeof l.listeners.onToolActivated&&q.activated.add(l.listeners.onToolActivated);return function(){var a=new paper.Tool({onMouseDown:p,onMouseUp:p,onMouseDrag:p,onKeyDown:p,onKeyUp:p});a.activate()}(),{events:q,tools:m,getTool:f,getToolJSONImporter:h,getToolJSONExporter:i,activateTool:g,getActiveTool:e,serializeItem:j,setRo:k}});
/*! AdIm - v0.0.0 - 2018-03-05 - Copyright (C) 2018 Université de Lausanne - see licence */
define('adim/view',["jquery","underscore","paper","signals","adim/config","adim/users","adim/tools"],function(a,b,c,d,e,f,g){function h(a){if(!a)return!1;if(!isNaN(parseInt(a,10)))return i(a);var b=F[a]||null;if(!b)for(var d,e=2===a.indexOf(":")?a.substr(3):null,f=c.project.layers,g=0;d=f[g];g++){var h=e?d.id.toString()===e:d.name===a;if(h){b=d,F[a]=d;break}}return b}function i(a){return a=parseInt(a,10),b(c.project.layers).findWhere({id:a})}function j(b,d){var e=h(b);if(d=d||{},!e){var f=c.project.activeLayer;e=new c.Layer({name:b}),a.extend(e.data,d),F[b]=e,f&&f.activate()}return e}function k(a,b){var c="user_"+a,d=b||f.getById(a)||a;return j(c,{owner:d,ownerId:a})}function l(a,b){var d=h(a);return d?(b="undefined"==typeof b?!d.visible:"function"==typeof b?!!b():!!b,d.visible=b,c.view.draw(),C.userLayerVisibilityChanged.dispatch(d,d.visible),d.visible):null}function m(){var a=[];return c.project.getSelectedItems().map(function(b){b.parent&&b.parent.data&&b.parent.data.type&&a.indexOf(b.parent)===-1?a.push(b.parent):b.data&&b.data.type&&a.indexOf(b)===-1&&a.push(b)}),a}function n(c,d){var f,h,i;try{f="string"==typeof c.item?JSON.parse(c.item):c.item}catch(a){throw"Unable to parse annotation's item"}if(!a.isArray(f)||f.length<2)return null;if("string"==typeof f[0]?h=f[1].data:a.isArray(f[0])&&(h=f[1][1].data),!h)return null;if(i=h.type,!b.isEmpty(e.activeTools)&&!b.contains(e.activeTools,i))return null;var j=k(c.owner),l=g.getToolJSONImporter(i)(f,j,d);return l&&(l.data.id=c.id,l.selected=!1),l}function o(a){for(var b,c=[],d=0;b=a[d];d++)if(b.data&&b.data.type){var e={id:b.data.id,itemStr:g.serializeItem(b),index:b.index};b.data.prop&&(e.prop=b.data.prop),c.push(e)}return c}function p(a){for(var b=c.project.layers,d=null,e=0,f=b.length;e<f;e++)for(var g=b[e].children,h=0,i=g.length;h<i;h++)if(g[h].data.tId===a){d=g[h];break}return d}function q(){for(var a,b=m(),d=0;a=b[d];d++)a.remove(),C.annotationRemoved.dispatch(a);c.view.draw()}function r(a){c.project.view.scrollBy(a),c.project.view.draw()}function s(a,b){if(b=void 0===b||!!b,"string"==typeof a){for(var d,e=a.split(","),f=0,h=c.project.layers;d=h[f];f++)for(var i,j=0,k=d.children;i=k[j];j++)i.data&&i.data.type&&e.indexOf(i.data.type)>-1&&(i.selected&&(i.selected=!1,g.events.annotationSelected.dispatch(null)),i.visible=b);c.view.draw()}}function t(a,d){d=!!b.isUndefined(d)||!!d;for(var e,f=a.val.split(","),h=0,i=c.project.layers;e=i[h];h++)for(var j,k=0,l=e.children;j=l[k];k++)if(j.data&&j.data.prop){var m=b.isUndefined(j.data.prop[a.prop])?f.indexOf("")>-1&&a.undef===!0:f.indexOf(j.data.prop[a.prop])>-1;m&&(j.selected&&(j.selected=!1,g.events.annotationSelected.dispatch(null)),j.visible=d)}c.view.draw()}function u(a,d){d=!!b.isUndefined(d)||d;for(var e,f=a.split(","),h=[],i=0,j=c.project.layers;e=j[i];i++)for(var k,l=0,m=e.children;k=m[l];l++)k.data&&k.data.type&&f.indexOf(k.data.type)>-1&&k.visible&&(k.selected=d,h.push(k));g.events.annotationSelected.dispatch(h),c.view.draw()}function v(a,b,c){var d=!1;return a.data&&a.data.prop&&(d=a.data.prop[b]!==c,d&&(a.data.prop[b]=c,"function"==typeof a.onPropertyChange&&a.onPropertyChange(b,c),C.annotationPropertyChanged.dispatch(a,b,c))),d}function w(a,b,c){var d=m();c||(d=d.length?d[0]:[]);for(var e,f=!0,g=0;e=d[g];g++)f=v(e,a,b)&&f;return f}function x(a,b){return a.data&&a.data.prop&&a.data.prop.hasOwnProperty(b)?a.data.prop[b]:null}function y(a){var b=c.project.getSelectedItems();return 1===b.length?x(b[0],a):null}var z=null,A=null,B=null,C={imageLoaded:new d,annotationsLoaded:new d,annotationRemoved:new d,annotationPropertyChanged:new d,userLayerVisibilityChanged:new d},D=e.users,E={strokeWidth:7,strokeColor:"red",font:"Helvetica,Arial,sans-serif",fontSize:32},F={};return{init:function(b){return"string"==typeof b&&"#"!==b.substr(0,1)&&(b="#"+b),z=a(b),0===z.length?(console&&console.warn&&console.warn("Unable to find canvas element: "+b),!1):(c.setup(z.get(0)),c.project.activeLayer.name="image",a.extend(c.project.currentStyle,E),B=k(e.user.id,e.user.username),B.opacity=1,!0)},events:C,loadUserDict:function(a){D=e.users},updateUserDict:function(b){a.extend(D,b)},resize:function(a,b){z&&(a=parseInt(a,10)||z.width(),b=parseInt(b,10)||z.height(),z.width("100%").height(b),c.view.viewSize=[a,b],A&&(A.position=[A.bounds.width/2,A.bounds.height/2]))},scrollBy:r,loadImage:function(b,d,e){b="string"==typeof b?{url:b}:a.extend({url:""},b);var f=c.project.activeLayer,g=j("image");g.activate(),A=new c.Raster,A.onLoad=function(){var a=c.project.activeLayer;g.activate();var f;b.bgUrl?(f=new c.Raster(b.bgUrl),f.translate(A.width/2,A.height/2)):f=new c.Path.Rectangle({from:[0,0],to:[A.width,A.height],fillColor:"white",strokeColor:null}),f.sendToBack(),a.activate(),C.imageLoaded.dispatch({raster:A}),"function"==typeof d&&d.call(e,A)},A.source=b.url,A.position=[0,0],f.activate()},loadAnnotation:n,loadAnnotations:function(b,d){for(var f,i=[],j=b.length-1;f=b[j];j--){var k=f.owner===d;(e.ui.show_users_results||k)&&i.push(n(f,k))}if(d){var l=h("user_"+d);if(l){var m=c.project.layers,o=m.splice(l._index,1);m.push(o[0]),a.each(m,function(a,b){b._index=a}),l=h("user_"+d),l.activate(),c.view.draw()}}console.log(">> before dispatch annotationsLoaded"),C.annotationsLoaded.dispatch(i,d),c.project.deselectAll(),g.events.annotationSelected.dispatch(null),c.view.draw()},removeSelectedItems:q,getUserAnnnotationsSerialized:function(a){var b=h("user_"+a);return o(b.children)},getSelectedAnnotations:m,getSelectedAnnnotationsSerialized:function(){for(var a,b=c.project.getSelectedItems(),d=[],e=0;a=b[e];e++)a.data.type&&d.push(a);return o(d)},getAnnotationsSerialized:function(b){return a.isArray(b)||(b=[b]),o(b)},getItemByTempId:p,setItemProperty:v,setSelectedItemProperty:w,getSelectedItemProperty:y,showItemsByType:function(a){s(a,!0)},hideItemsByType:function(a){s(a,!1)},toggleItemsByType:s,toggleItemsByProp:t,selectItemsByType:u,getLayerByName:h,getOrCreateLayerByName:j,getOrCreateUserLayer:k,getUserLayer:function(a){return h("user_"+a)},getAllUsersLayers:function(){for(var a=[],b=0,d=c.project.layers;b<d.length;b++)"user_"===d[b].name.substr(0,5)&&a.push(d[b]);return a},showLayer:function(a){l(a,!0)},hideLayer:function(a){l(a,!1)},toggleLayer:function(a,b){return l(a,b)},toggleMembersLayers:function(){function a(a,b){return b?e[a.id]:b}var d,e={};return function(f,h){c.project.deselectAll(),g.events.annotationSelected.dispatch(null);var i=this.getAllUsersLayers();f||(d=c.project.activeLayer,b.reduce(i,function(a,b){return a[b.id]=b.visible,a},e)),b.each(i,function(b){l(b.name,h?f:a(b,f))}),f?d&&d.activate():(l(B.id,!0),B.activate())}}(),_raster:function(){return A}}});
/*! AdIm - v0.0.0 - 2018-03-05 - Copyright (C) 2018 Université de Lausanne - see licence */
......@@ -15901,7 +15901,7 @@ define('tools/arrowgeo',["paper","tools/Shape.class","adim/category"],function(a
/*! AdIm - v0.0.0 - 2018-03-05 - Copyright (C) 2018 Université de Lausanne - see licence */
define('tools/textgeo',["paper","jquery","adim/category"],function(a,b,c){function d(a,b){!a in D?(E=null,F={},G=!1):(E=D[a],F=b)}function e(a){switch(E){case D.DRAG_HANDLE:if("center"===F.nameParts[1])return;var b=F.item.bounds,c="top"===F.nameParts[0]?b.bottom-a.point.y:a.point.y-b.top,d=c/1.2,e=[0,0];"bottom"===F.nameParts[0]&&(e[1]=c-b.height),d>9&&d<999&&j.call(F.item,d),F.item.translate(e);break;case D.FULL_DRAG:default:this.translate(a.delta)}}function f(a){a.data.prop="object"==typeof a.data.prop?a.data.prop:{};for(var b in A)a.data.prop.hasOwnProperty(b)||(a.data.prop[b]=A[b]);a.oGetSelected=function(){return this.children[1].selected},a.oSetSelected=function(a){this.children[1].selected=a},a.data.setDragMode=d,a.data.itemMouseDrag=e}function g(c){if(u&&h(!1),!y){u=!0,w||(w=b("<input>",{type:"text",class:"text-tool-input",placeholder:"Votre texte",maxlength:128,size:128,style:"display:none;position:absolute;top:0;left:0;padding:10px;border:0;border-radius:5px;background:rgba(255,255,255,0.75);"}).appendTo(a.project.view.element.parentNode).on("blur",function(){u&&h()}).on("keydown",function(a){27!==a.which&&13!=a.which||h()}).autoGrowInput(),x=x||b("<div>").css({zIndex:999,position:"fixed",display:"none",top:"-10px",left:"-10px",width:"5000px",height:"5000px"}).click(function(){h()}),w.before(x)),c.selected=!1,c.visible=!1;var d=c.children[1].point;d=d.subtract(a.view.bounds.point).multiply(a.view.zoom);var e=c.fontSize*a.view.zoom;c.data.color=m(B.category),w.val(c.data.content).css({fontSize:e+"px",fontFamily:c.font,color:c.data.color,top:d.y-e+1-10,left:d.x-1-10,zIndex:1e3}).show(),x.show();var f=w.nextAll("tester");f.css({fontSize:w.css("fontSize"),fontFamily:w.css("fontFamily"),fontWeight:w.css("fontWeight"),letterSpacing:w.css("letterSpacing")}),f.text(""===c.data.content?w.attr("placeholder"):c.data.content),w.width(f.width()+30),v=c,setTimeout(function(){w.focus()},100)}}function h(b){if(b=!(b===!1),u=!1,v){var c=w.val();if(c&&""!==c){var d=""===v.data.content;v.data.content=c,v.children[0].content=c,v.children[1].content=c,v.visible=!0,v.onPropertyChange=s,b&&z.annotationSelected&&"function"==typeof z.annotationSelected.dispatch&&z.annotationSelected.dispatch(v),d?(f(v),z.annotationAdded&&"function"==typeof z.annotationAdded.dispatch&&z.annotationAdded.dispatch(v),v.selected=!0,z.annotationSelected.dispatch(v)):z.annotationChanged&&"function"==typeof z.annotationChanged.dispatch&&z.annotationChanged.dispatch(v),v.oSetSelected(b),a.project.view.draw()}else v.remove(),v=null}return x.hide(),w.val("").blur().hide(),v}function i(a){var b=this,c=b.children[1].fillColor!==a;return b.children[1].fillColor=a,b.data.color=a,c}function j(a){var b=this,c=a/10;c<3&&(c=3),b.children[0].fontSize=a,b.children[0].strokeWidth=c,b.children[1].fontSize=a}function k(){return this.children[0].fontSize}function l(a){B.category=a}function m(a){var b=c.getCategory(a),d=b&&b.color||"#000000";return d}function n(a){var b=c.getCategory(a),d=b&&b.colorbg||"#000000";return d}function o(){if(this.prop){var a=c.getCategory(this.prop.category),b=a&&a.colorbg||"#000000";return b}return"#000000"}function p(a,c,d){var e=c.importJSON(a),h=e.data.prop;for(var p in B)h.hasOwnProperty(p)||(h[p]=B[p]);return b.extend(e.data,{setColor:i,setFill:C,setStrokeWidth:C,setFontSize:j,getFontSize:k,prop:h,setCategory:l,getColorBgD:o}),e.onPropertyChange=s,e.data.color=m(e.data.prop.category),e.style={strokeColor:n(e.data.prop.category),fillColor:m(e.data.prop.category)},f(e),d&&e.children[1].on("doubleclick",function(){g(this.parent)}),e}function q(a){var c=this.selected;this.selected=!1;var d=this.exportJSON({asString:!1});return b.each(d[1].children,function(a,b){delete b[1].leading}),d=a&&a.asString===!1?d:JSON.stringify(d),c&&(this.selected=c),d}function r(a){return a!==y&&(y=a),y}function s(b,c){"category"===b&&(l.call(this,c),this.style={fillColor:m(c),strokeColor:n(c)},a.view.draw())}var t="textgeo",u=!1,v=null,w=null,x=null,y=!1,z={annotationAdded:null,annotationChanged:null,annotationSelected:null},A={type:"point-text",comment:"",tolerance:5,fill:!0},B={comment:"",category:"cat_geo_1",fill:!0},C=function(){},D={FULL_DRAG:1,DRAG_HANDLE:4},E=null,F={},G=!1,H={onMouseDown:function(b){if(!y){var c=a.project.activeLayer.hitTest(b.point,A);if(c){var d=c.item.parent;g(d)}else{var e=a.project.currentStyle.fontSize;if(u)h();else{a.project.deselectAll();var f=b.point,m=new a.PointText({point:f,fillColor:"white",strokeColor:"white",strokeWidth:e/6,strokeJoin:"round",content:""}),n=a.project.currentStyle.strokeColor||a.project.currentStyle.fillColor;n=n.toCSS();var p=new a.PointText({point:f,fillColor:n,strokeColor:n,strokeWidth:0,content:""});p.on("doubleclick",function(){g(this.parent)});var q={};for(var r in B)q.hasOwnProperty(r)||(q[r]=B[r]);v=new a.Group({children:[m,p],data:{type:t,setColor:i,setFill:C,setStrokeWidth:C,setFontSize:j,getFontSize:k,prop:q,setCategory:l,getColorBgD:o,content:"",color:n}}),v.data.tId="a"+v._id,v.data.content="",g(v)}}}}};return{name:t,tool:new a.Tool(H),setRo:r,exportJSON:q,importJSON:p,registerEvent:function(a,b){z[a]=b}}});
/*! AdIm - v0.0.0 - 2018-03-05 - Copyright (C) 2018 Université de Lausanne - see licence */
define('adim/tools',["underscore","signals","tools/select","tools/pan","tools/drawing","tools/lines","tools/ellipse","tools/rectangle","tools/text","tools/arrow","tools/fieldedges","tools/concordantstr","tools/discordantstr","tools/cmsarea","tools/marker","tools/drawinggeo","tools/linesgeo","tools/ellipsegeo","tools/rectanglegeo","tools/arrowgeo","tools/textgeo"],function(a,b){function c(a,b){return b.importJSON(a)}function d(a){return this.exportJSON(a)}function e(){return n}function f(a){return m[a]?m[a].tool:null}function g(a){if(a&&m[a]){var b=f(n);b&&q.annotationCheckCancel.dispatch(b);var c=f(a);c?(n=a,c.activate(),q.activated.dispatch(a)):console&&console.warn&&console.warn("Tool «"+a+"» not activated")}}function h(a){return m[a]&&"function"==typeof m[a].importJSON?m[a].importJSON:p}function i(a){return m[a]&&"function"==typeof m[a].exportJSON?m[a].exportJSON:p}function j(a,b){var c=i(a.data.type);return c.call(a,$.extend({asString:!0},b))}function k(b){b!==o&&(o=b,a.invoke(m,"setRo",b))}for(var l,m={},n=null,o=null,p=function(){},q={activated:new b,annotationAdded:new b,annotationChanged:new b,annotationSelected:new b},r=1;l=arguments[r];r++)m[l.name]={tool:l.tool,importJSON:l.importJSON||c,exportJSON:l.exportJSON||d,setRo:l.setRo||p,listeners:l.listeners||{},events:l.events||{}},"function"==typeof l.registerEvent&&(l.registerEvent("annotationAdded",q.annotationAdded),l.registerEvent("annotationChanged",q.annotationChanged),l.registerEvent("annotationSelected",q.annotationSelected)),l.listeners&&"function"==typeof l.listeners.onToolActivated&&q.activated.add(l.listeners.onToolActivated);return function(){var a=new paper.Tool({onMouseDown:p,onMouseUp:p,onMouseDrag:p,onKeyDown:p,onKeyUp:p});a.activate()}(),{events:q,tools:m,getTool:f,getToolJSONImporter:h,getToolJSONExporter:i,activateTool:g,getActiveTool:e,serializeItem:j,setRo:k}});
define('adim/tools',["underscore","signals","tools/select","tools/pan","tools/drawing","tools/lines","tools/ellipse","tools/rectangle","tools/text","tools/arrow","tools/fieldedges","tools/concordantstr","tools/discordantstr","tools/cmsarea","tools/marker","tools/drawinggeo","tools/linesgeo","tools/ellipsegeo","tools/rectanglegeo","tools/arrowgeo","tools/textgeo"],function(a,b){function c(a,b){return b.importJSON(a)}function d(a){return this.exportJSON(a)}function e(){return n}function f(a){return m[a]?m[a].tool:null}function g(a){if(a&&m[a]){var b=f(n);b&&q.annotationCheckCancel.dispatch(b);var c=f(a);c?(n=a,c.activate(),q.activated.dispatch(a)):console&&console.warn&&console.warn("Tool «"+a+"» not activated")}}function h(a){return m[a]&&"function"==typeof m[a].importJSON?m[a].importJSON:p}function i(a){return m[a]&&"function"==typeof m[a].exportJSON?m[a].exportJSON:p}function j(a,b){var c=i(a.data.type);return c.call(a,$.extend({asString:!0},b))}function k(b){b!==o&&(o=b,a.invoke(m,"setRo",b))}for(var l,m={},n=null,o=null,p=function(){},q={activated:new b,annotationAdded:new b,annotationChanged:new b,annotationSelected:new b,annotationCheckCancel:new b},r=1;l=arguments[r];r++)m[l.name]={tool:l.tool,importJSON:l.importJSON||c,exportJSON:l.exportJSON||d,setRo:l.setRo||p,listeners:l.listeners||{},events:l.events||{}},"function"==typeof l.registerEvent&&(l.registerEvent("annotationAdded",q.annotationAdded),l.registerEvent("annotationChanged",q.annotationChanged),l.registerEvent("annotationSelected",q.annotationSelected)),l.listeners&&"function"==typeof l.listeners.onToolActivated&&q.activated.add(l.listeners.onToolActivated);return function(){var a=new paper.Tool({onMouseDown:p,onMouseUp:p,onMouseDrag:p,onKeyDown:p,onKeyUp:p});a.activate()}(),{events:q,tools:m,getTool:f,getToolJSONImporter:h,getToolJSONExporter:i,activateTool:g,getActiveTool:e,serializeItem:j,setRo:k}});
/*! AdIm - v0.0.0 - 2018-03-05 - Copyright (C) 2018 Université de Lausanne - see licence */
define('adim/view',["jquery","underscore","paper","signals","adim/config","adim/users","adim/tools"],function(a,b,c,d,e,f,g){function h(a){if(!a)return!1;if(!isNaN(parseInt(a,10)))return i(a);var b=F[a]||null;if(!b)for(var d,e=2===a.indexOf(":")?a.substr(3):null,f=c.project.layers,g=0;d=f[g];g++){var h=e?d.id.toString()===e:d.name===a;if(h){b=d,F[a]=d;break}}return b}function i(a){return a=parseInt(a,10),b(c.project.layers).findWhere({id:a})}function j(b,d){var e=h(b);if(d=d||{},!e){var f=c.project.activeLayer;e=new c.Layer({name:b}),a.extend(e.data,d),F[b]=e,f&&f.activate()}return e}function k(a,b){var c="user_"+a,d=b||f.getById(a)||a;return j(c,{owner:d,ownerId:a})}function l(a,b){var d=h(a);return d?(b="undefined"==typeof b?!d.visible:"function"==typeof b?!!b():!!b,d.visible=b,c.view.draw(),C.userLayerVisibilityChanged.dispatch(d,d.visible),d.visible):null}function m(){var a=[];return c.project.getSelectedItems().map(function(b){b.parent&&b.parent.data&&b.parent.data.type&&a.indexOf(b.parent)===-1?a.push(b.parent):b.data&&b.data.type&&a.indexOf(b)===-1&&a.push(b)}),a}function n(c,d){var f,h,i;try{f="string"==typeof c.item?JSON.parse(c.item):c.item}catch(a){throw"Unable to parse annotation's item"}if(!a.isArray(f)||f.length<2)return null;if("string"==typeof f[0]?h=f[1].data:a.isArray(f[0])&&(h=f[1][1].data),!h)return null;if(i=h.type,!b.isEmpty(e.activeTools)&&!b.contains(e.activeTools,i))return null;var j=k(c.owner),l=g.getToolJSONImporter(i)(f,j,d);return l&&(l.data.id=c.id,l.selected=!1),l}function o(a){for(var b,c=[],d=0;b=a[d];d++)if(b.data&&b.data.type){var e={id:b.data.id,itemStr:g.serializeItem(b),index:b.index};b.data.prop&&(e.prop=b.data.prop),c.push(e)}return c}function p(a){for(var b=c.project.layers,d=null,e=0,f=b.length;e<f;e++)for(var g=b[e].children,h=0,i=g.length;h<i;h++)if(g[h].data.tId===a){d=g[h];break}return d}function q(){for(var a,b=m(),d=0;a=b[d];d++)a.remove(),C.annotationRemoved.dispatch(a);c.view.draw()}function r(a){c.project.view.scrollBy(a),c.project.view.draw()}function s(a,b){if(b=void 0===b||!!b,"string"==typeof a){for(var d,e=a.split(","),f=0,h=c.project.layers;d=h[f];f++)for(var i,j=0,k=d.children;i=k[j];j++)i.data&&i.data.type&&e.indexOf(i.data.type)>-1&&(i.selected&&(i.selected=!1,g.events.annotationSelected.dispatch(null)),i.visible=b);c.view.draw()}}function t(a,d){d=!!b.isUndefined(d)||!!d;for(var e,f=a.val.split(","),h=0,i=c.project.layers;e=i[h];h++)for(var j,k=0,l=e.children;j=l[k];k++)if(j.data&&j.data.prop){var m=b.isUndefined(j.data.prop[a.prop])?f.indexOf("")>-1&&a.undef===!0:f.indexOf(j.data.prop[a.prop])>-1;m&&(j.selected&&(j.selected=!1,g.events.annotationSelected.dispatch(null)),j.visible=d)}c.view.draw()}function u(a,d){d=!!b.isUndefined(d)||d;for(var e,f=a.split(","),h=[],i=0,j=c.project.layers;e=j[i];i++)for(var k,l=0,m=e.children;k=m[l];l++)k.data&&k.data.type&&f.indexOf(k.data.type)>-1&&k.visible&&(k.selected=d,h.push(k));g.events.annotationSelected.dispatch(h),c.view.draw()}function v(a,b,c){var d=!1;return a.data&&a.data.prop&&(d=a.data.prop[b]!==c,d&&(a.data.prop[b]=c,"function"==typeof a.onPropertyChange&&a.onPropertyChange(b,c),C.annotationPropertyChanged.dispatch(a,b,c))),d}function w(a,b,c){var d=m();c||(d=d.length?d[0]:[]);for(var e,f=!0,g=0;e=d[g];g++)f=v(e,a,b)&&f;return f}function x(a,b){return a.data&&a.data.prop&&a.data.prop.hasOwnProperty(b)?a.data.prop[b]:null}function y(a){var b=c.project.getSelectedItems();return 1===b.length?x(b[0],a):null}var z=null,A=null,B=null,C={imageLoaded:new d,annotationsLoaded:new d,annotationRemoved:new d,annotationPropertyChanged:new d,userLayerVisibilityChanged:new d},D=e.users,E={strokeWidth:7,strokeColor:"red",font:"Helvetica,Arial,sans-serif",fontSize:32},F={};return{init:function(b){return"string"==typeof b&&"#"!==b.substr(0,1)&&(b="#"+b),z=a(b),0===z.length?(console&&console.warn&&console.warn("Unable to find canvas element: "+b),!1):(c.setup(z.get(0)),c.project.activeLayer.name="image",a.extend(c.project.currentStyle,E),B=k(e.user.id,e.user.username),B.opacity=1,!0)},events:C,loadUserDict:function(a){D=e.users},updateUserDict:function(b){a.extend(D,b)},resize:function(a,b){z&&(a=parseInt(a,10)||z.width(),b=parseInt(b,10)||z.height(),z.width("100%").height(b),c.view.viewSize=[a,b],A&&(A.position=[A.bounds.width/2,A.bounds.height/2]))},scrollBy:r,loadImage:function(b,d,e){b="string"==typeof b?{url:b}:a.extend({url:""},b);var f=c.project.activeLayer,g=j("image");g.activate(),A=new c.Raster,A.onLoad=function(){var a=c.project.activeLayer;g.activate();var f;b.bgUrl?(f=new c.Raster(b.bgUrl),f.translate(A.width/2,A.height/2)):f=new c.Path.Rectangle({from:[0,0],to:[A.width,A.height],fillColor:"white",strokeColor:null}),f.sendToBack(),a.activate(),C.imageLoaded.dispatch({raster:A}),"function"==typeof d&&d.call(e,A)},A.source=b.url,A.position=[0,0],f.activate()},loadAnnotation:n,loadAnnotations:function(b,d){for(var f,i=[],j=b.length-1;f=b[j];j--){var k=f.owner===d;(e.ui.show_users_results||k)&&i.push(n(f,k))}if(d){var l=h("user_"+d);if(l){var m=c.project.layers,o=m.splice(l._index,1);m.push(o[0]),a.each(m,function(a,b){b._index=a}),l=h("user_"+d),l.activate(),c.view.draw()}}console.log(">> before dispatch annotationsLoaded"),C.annotationsLoaded.dispatch(i,d),c.project.deselectAll(),g.events.annotationSelected.dispatch(null),c.view.draw()},removeSelectedItems:q,getUserAnnnotationsSerialized:function(a){var b=h("user_"+a);return o(b.children)},getSelectedAnnotations:m,getSelectedAnnnotationsSerialized:function(){for(var a,b=c.project.getSelectedItems(),d=[],e=0;a=b[e];e++)a.data.type&&d.push(a);return o(d)},getAnnotationsSerialized:function(b){return a.isArray(b)||(b=[b]),o(b)},getItemByTempId:p,setItemProperty:v,setSelectedItemProperty:w,getSelectedItemProperty:y,showItemsByType:function(a){s(a,!0)},hideItemsByType:function(a){s(a,!1)},toggleItemsByType:s,toggleItemsByProp:t,selectItemsByType:u,getLayerByName:h,getOrCreateLayerByName:j,getOrCreateUserLayer:k,getUserLayer:function(a){return h("user_"+a)},getAllUsersLayers:function(){for(var a=[],b=0,d=c.project.layers;b<d.length;b++)"user_"===d[b].name.substr(0,5)&&a.push(d[b]);return a},showLayer:function(a){l(a,!0)},hideLayer:function(a){l(a,!1)},toggleLayer:function(a,b){return l(a,b)},toggleMembersLayers:function(){function a(a,b){return b?e[a.id]:b}var d,e={};return function(f,h){c.project.deselectAll(),g.events.annotationSelected.dispatch(null);var i=this.getAllUsersLayers();f||(d=c.project.activeLayer,b.reduce(i,function(a,b){return a[b.id]=b.visible,a},e)),b.each(i,function(b){l(b.name,h?f:a(b,f))}),f?d&&d.activate():(l(B.id,!0),B.activate())}}(),_raster:function(){return A}}});
/*! AdIm - v0.0.0 - 2018-03-05 - Copyright (C) 2018 Université de Lausanne - see licence */
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