Gitlab CSE Unil

Commit 11d718b9 authored by M. Chardon's avatar M. Chardon
Browse files

compilation JS

parent 9841bb9c
......@@ -103,27 +103,6 @@ function ($, _, paper, Signal, Config, view) {
});
});
/* $.ajax({
url: url,
type: method,
dataType: 'json',
data: annotJson,
success: function(data, status, jqXHR) {
if (jqXHR.status === 201) {
_events.annotationAdded.dispatch(data);
}
else if (jqXHR.status === 200) {
_events.annotationSaved.dispatch(data);
}
},
error: function() {
_events.loadingError.dispatch({
msg: "Erreur lors de l'enregistrement d'une annotation"
});
}
});*/
}
......
......@@ -261,7 +261,6 @@ define(["paper", "jquery"], function (paper, $) {
var textGroup = this;
var changed = textGroup.children[1].fillColor !== color;
textGroup.children[1].fillColor = color;
console.log(color);
textGroup.children[0].strokeColor = getBackgroundColor(color, 0.3);
textGroup.data.color = color;
return changed;
......
......@@ -303,8 +303,6 @@ define([
_$w.on('resize', function (event) {
startResize();
afterResize();
//adjustCanvasToImage();
//_$mainNavBar.find(".adim-image-name .text").css("max-width", _$w.width() - _navBarTitleDelta);
});
})();
......@@ -1629,11 +1627,6 @@ define([
case 'svg':
exporter.export(exportBaseFileName, 'svg');
/*var m = $("#dlg-export-svg-info");
m.modal('show');
setTimeout(function(){
exporter.export(exportBaseFileName, 'svg',{callback: function(){m.modal('hide');}});
}, 100);*/
break;
}
......
......@@ -18124,7 +18124,8 @@ define('tools/text',["paper", "jquery"], function (paper, $) {
};
// ----- Initialisations ------------------------------
var _noop = function(){};
var _noop = function () {
};
// ----- Item's event listeners -----------------------
function itemMouseDown(event) {
......@@ -18143,7 +18144,7 @@ define('tools/text',["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;
......@@ -18163,7 +18164,7 @@ define('tools/text',["paper", "jquery"], function (paper, $) {
height = (_dragOpts.nameParts[0] === 'top') ?
bounds.bottom - event.point.y :
event.point.y - bounds.top,
fontSize = height / 1.2,
fontSize = height / 1.2,
offset = [0, 0];
if (_dragOpts.nameParts[0] === 'bottom') {
offset[1] = height - bounds.height;
......@@ -18172,7 +18173,7 @@ define('tools/text',["paper", "jquery"], function (paper, $) {
setFontSize.call(_dragOpts.item, fontSize);
}
_dragOpts.item.translate(offset);
break;
break;
case DRAG_MODES.FULL_DRAG:
default:
this.translate(event.delta);
......@@ -18187,7 +18188,7 @@ define('tools/text',["paper", "jquery"], function (paper, $) {
item.data.prop[p] = hitOptions[p];
}
item.oGetSelected = function() {
item.oGetSelected = function () {
return this.children[1].selected;
// for (var i = 0, l = this.children.length; i<l; i++) {
// if (!this.children.selected)
......@@ -18195,7 +18196,7 @@ define('tools/text',["paper", "jquery"], function (paper, $) {
// }
// return true;
};
item.oSetSelected = function(selected) {
item.oSetSelected = function (selected) {
//this.children.map(function(c) {c.selected = selected});
this.children[1].selected = selected;
};
......@@ -18214,7 +18215,9 @@ define('tools/text',["paper", "jquery"], function (paper, $) {
// ----- Functions ------------------------------------
function _startEdit(myText) {
if (edit) { _terminateEdit(false); }
if (edit) {
_terminateEdit(false);
}
if (_ro) return;
edit = true;
......@@ -18228,18 +18231,24 @@ define('tools/text',["paper", "jquery"], function (paper, $) {
style: "display:none;position:absolute;top:0;left:0;padding:10px;border:0;border-radius:5px;background:rgba(255,255,255,0.75);"
}
)
.appendTo(paper.project.view.element.parentNode)
.on("blur", function(){ if(edit) _terminateEdit(); })
.on("keydown", function(event){ if(event.which === 27 || event.which == 13) _terminateEdit(); })
.autoGrowInput();
.appendTo(paper.project.view.element.parentNode)
.on("blur", function () {
if (edit) _terminateEdit();
})
.on("keydown", function (event) {
if (event.which === 27 || event.which == 13) _terminateEdit();
})
.autoGrowInput();
overlay = overlay || $("<div>").css({
zIndex: 999,
position: "fixed", display: "none",
top: "-10px", left: "-10px",
width: "5000px", height: "5000px"
})
.click(function(){ _terminateEdit() });
zIndex: 999,
position: "fixed", display: "none",
top: "-10px", left: "-10px",
width: "5000px", height: "5000px"
})
.click(function () {
_terminateEdit()
});
input.before(overlay);
}
myText.selected = false;
......@@ -18271,13 +18280,13 @@ define('tools/text',["paper", "jquery"], function (paper, $) {
letterSpacing: input.css('letterSpacing')
});
tester.text( (myText.data.content === "") ? input.attr("placeholder") : myText.data.content);
input.width(tester.width()+30);
tester.text((myText.data.content === "") ? input.attr("placeholder") : myText.data.content);
input.width(tester.width() + 30);
gText = myText;
setTimeout(function(){
setTimeout(function () {
input.focus();
},100);
}, 100);
}
/**
......@@ -18301,7 +18310,7 @@ define('tools/text',["paper", "jquery"], function (paper, $) {
gText.children[1].content = textVal;
gText.visible = true;
if(selectAfter)
if (selectAfter)
if (_events.annotationSelected && typeof _events.annotationSelected.dispatch === 'function') {
_events.annotationSelected.dispatch(gText);
}
......@@ -18330,15 +18339,52 @@ define('tools/text',["paper", "jquery"], function (paper, $) {
var textGroup = this;
var changed = textGroup.children[1].fillColor !== color;
textGroup.children[1].fillColor = color;
textGroup.children[0].strokeColor = getBackgroundColor(color, 0.3);
textGroup.data.color = color;
return changed;
}
/**
* get background color tint form main fill color
* @param color hexa or rgb color
* @param lum tint factor
* @returns {string} rgb color
*/
function getBackgroundColor(color, lum) {
var red = null;
var green = null;
var blue = null;
var resulthexa = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(color);
if (resulthexa) {
//on a une couleur en hexa
red = parseInt(resulthexa[1], 16);
green = parseInt(resulthexa[2], 16);
blue = parseInt(resulthexa[3], 16);
} else {
//couleur en rgb
var digits = /(.*?)rgb\((\d+), (\d+), (\d+)\)/.exec(color);
red = parseInt(digits[2]);
green = parseInt(digits[3]);
blue = parseInt(digits[4]);
}
lum = lum || 0;
red = red + (255 - red) * lum;
green = green + (255 - green) * lum;
blue = blue + (255 - blue) * lum;
return 'rgb(' + red + ', ' + green + ', ' + blue + ')';
}
function setFontSize(size) {
var textGroup = this;
var sw = size / 10;
if (sw < 3) { sw = 3; }
if (sw < 3) {
sw = 3;
}
textGroup.children[0].fontSize = size;
textGroup.children[0].strokeWidth = sw;
textGroup.children[1].fontSize = size;
......@@ -18358,15 +18404,14 @@ define('tools/text',["paper", "jquery"], function (paper, $) {
// ----- Tool Def -------------------------------------
var toolDef = {
onMouseDown: function(event){
onMouseDown: function (event) {
if (_ro) return;
var hitResult = paper.project.activeLayer.hitTest(event.point, hitOptions);
if (hitResult) {
var hitGroup = hitResult.item.parent;
_startEdit(hitGroup);
}
else {
} else {
var fontSize = paper.project.currentStyle.fontSize;
if (!edit) {
......@@ -18378,12 +18423,9 @@ define('tools/text',["paper", "jquery"], function (paper, $) {
var txtBg = new paper.PointText({
point: textPoint,
fillColor: 'white',
strokeColor: 'white',
strokeWidth: fontSize/6,
//strokeColor: 'white',
strokeWidth: fontSize / 6,
strokeJoin: 'round',
// shadowColor: 'black',
// shadowBlur: 10,
// shadowOffset: new paper.Point([5, 3]),
content: ""
});
......@@ -18394,11 +18436,11 @@ define('tools/text',["paper", "jquery"], function (paper, $) {
var txtFg = new paper.PointText({
point: textPoint,
fillColor: c,
strokeColor: c,
//strokeColor: c,
strokeWidth: 0,
content: ""
});
txtFg.on('doubleclick', function(){
txtFg.on('doubleclick', function () {
_startEdit(this.parent);
});
......@@ -18440,7 +18482,7 @@ define('tools/text',["paper", "jquery"], function (paper, $) {
});
attachListeners(gText);
if (!!listening) {
gText.children[1].on('doubleclick', function(){
gText.children[1].on('doubleclick', function () {
_startEdit(this.parent);
});
}
......@@ -18451,17 +18493,17 @@ define('tools/text',["paper", "jquery"], function (paper, $) {
function exportJSON(param) {
var wasSelected = this.selected;
this.selected = false;
var json = this.exportJSON({asString:false});
var json = this.exportJSON({asString: false});
$.each(json[1].children, function(i, c) {
delete(c[1].leading);
$.each(json[1].children, function (i, c) {
delete (c[1].leading);
});
// console.log(json);
json = (param && param.asString === false) ? json : JSON.stringify(json);
if (wasSelected) { this.selected = wasSelected; }
if (wasSelected) {
this.selected = wasSelected;
}
return json;
}
......@@ -18479,7 +18521,9 @@ define('tools/text',["paper", "jquery"], function (paper, $) {
setRo: _setRo,
exportJSON: exportJSON,
importJSON: importJSON,
registerEvent: function(eventName, evt) { _events[eventName] = evt; }
registerEvent: function (eventName, evt) {
_events[eventName] = evt;
}
};
});
/**
......@@ -21383,6 +21427,9 @@ define('tools/marker',[
}
function _setStrokeWidth(width) {
if (_.isString(width)){
width = parseInt(width);
}
this.data.radius = width + 10;
drawMarker(this);
}
......@@ -23875,12 +23922,9 @@ define('tools/textgeo',["paper", "jquery","adim/category"], function (paper, $,
var txtBg = new paper.PointText({
point: textPoint,
fillColor: 'white',
strokeColor: 'white',
//strokeColor: 'white',
strokeWidth: fontSize/6,
strokeJoin: 'round',
// shadowColor: 'black',
// shadowBlur: 10,
// shadowOffset: new paper.Point([5, 3]),
content: ""
});
......@@ -25140,27 +25184,6 @@ function ($, _, paper, Signal, Config, view) {
});
});
/* $.ajax({
url: url,
type: method,
dataType: 'json',
data: annotJson,
success: function(data, status, jqXHR) {
if (jqXHR.status === 201) {
_events.annotationAdded.dispatch(data);
}
else if (jqXHR.status === 200) {
_events.annotationSaved.dispatch(data);
}
},
error: function() {
_events.loadingError.dispatch({
msg: "Erreur lors de l'enregistrement d'une annotation"
});
}
});*/
}
......@@ -26922,11 +26945,6 @@ define('helper/exporter',[
var arrows = [], arr, aIdx;
if (options && options.thumbnailSize) {
// Enable strokeScaling for arrows
arrows = paper.project.getItems({data:{type:'arrow'}});
for (aIdx=0, arr; arr=arrows[aIdx]; aIdx++) {
arr.symbol.definition.strokeScaling = true;
}
paper.view.zoom = options.thumbnailSize / Math.max(ts.width, ts.height);
view.resize(ts.width * paper.view.zoom, ts.height * paper.view.zoom);
......@@ -26956,11 +26974,6 @@ define('helper/exporter',[
$.each(selectedAnnot, function(i, e){ e.selected=true; });
$.each(fullySelectedAnnot, function(i, e){ e.fullySelected=true; });
// Reset arrows strokeScaling to false if needed
for (aIdx=0, arr; arr=arrows[aIdx]; aIdx++) {
arr.symbol.definition.strokeScaling = false;
}
// Restore view params
paper.view.viewSize = s;
paper.view.zoom = z;
......@@ -31596,8 +31609,6 @@ define('adim/ui',[
_$w.on('resize', function (event) {
startResize();
afterResize();
//adjustCanvasToImage();
//_$mainNavBar.find(".adim-image-name .text").css("max-width", _$w.width() - _navBarTitleDelta);
});
})();
......@@ -32922,11 +32933,6 @@ define('adim/ui',[
case 'svg':
exporter.export(exportBaseFileName, 'svg');
/*var m = $("#dlg-export-svg-info");
m.modal('show');
setTimeout(function(){
exporter.export(exportBaseFileName, 'svg',{callback: function(){m.modal('hide');}});
}, 100);*/
break;
}
......@@ -35842,10 +35848,10 @@ function($){
!function(c){function e(e){if("string"==typeof e.data&&(e.data={keys:e.data}),e.data&&e.data.keys&&"string"==typeof e.data.keys){var o=e.handler,f=e.data.keys.toLowerCase().split(" ");e.handler=function(a){if(this===a.target||!(/textarea|select/i.test(a.target.nodeName)||c.hotkeys.options.filterTextInputs&&-1<c.inArray(a.target.type,c.hotkeys.textAcceptingInputTypes))){var s="keypress"!==a.type&&c.hotkeys.specialKeys[a.which],e=String.fromCharCode(a.which).toLowerCase(),r="",t={};c.each(["alt","ctrl","shift"],function(e,t){a[t+"Key"]&&s!==t&&(r+=t+"+")}),a.metaKey&&!a.ctrlKey&&"meta"!==s&&(r+="meta+"),a.metaKey&&"meta"!==s&&-1<r.indexOf("alt+ctrl+shift+")&&(r=r.replace("alt+ctrl+shift+","hyper+")),s?t[r+s]=!0:(t[r+e]=!0,t[r+c.hotkeys.shiftNums[e]]=!0,"shift+"===r&&(t[c.hotkeys.shiftNums[e]]=!0));for(var i=0,n=f.length;i<n;i++)if(t[f[i]])return o.apply(this,arguments)}}}}c.hotkeys={version:"0.8",specialKeys:{8:"backspace",9:"tab",10:"return",13:"return",16:"shift",17:"ctrl",18:"alt",19:"pause",20:"capslock",27:"esc",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down",45:"insert",46:"del",59:";",61:"=",96:"0",97:"1",98:"2",99:"3",100:"4",101:"5",102:"6",103:"7",104:"8",105:"9",106:"*",107:"+",109:"-",110:".",111:"/",112:"f1",113:"f2",114:"f3",115:"f4",116:"f5",117:"f6",118:"f7",119:"f8",120:"f9",121:"f10",122:"f11",123:"f12",144:"numlock",145:"scroll",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},shiftNums:{"`":"~",1:"!",2:"@",3:"#",4:"$",5:"%",6:"^",7:"&",8:"*",9:"(",0:")","-":"_","=":"+",";":": ","'":'"',",":"<",".":">","/":"?","\\":"|"},textAcceptingInputTypes:["text","password","number","email","url","range","date","month","week","time","datetime","datetime-local","search","color","tel"],options:{filterTextInputs:!0}},c.each(["keydown","keyup","keypress"],function(){c.event.special[this]={add:e}})}(jQuery||this.jQuery||window.jQuery);
define("jquery.hotkeys", ["jquery"], function(){});
/*! AdIm - v3.0.1 - 2019-04-23 - Copyright (C) 2019 Université de Lausanne - see licence */
/*! AdIm - v3.0.1 - 2019-04-24 - Copyright (C) 2019 Université de Lausanne - see licence */
define('env/shortcuts',["jquery","paper","signals","adim/config","adim/view","adim/tools","adim/ui","jquery.hotkeys"],function(e,t,n,c,o,i,r){return{"backspace del":[{event:"keydown",ctxt:"edit",fn:function(){return o.removeSelectedItems(),!1}},{event:"keydown",ctxt:"review",fn:function(){return!1}}],space:[{event:"keydown",fn:function(){return e("#tool-pan").click(),!1}}],a:[{event:"keydown",ctxt:"edit",fn:function(){return e("#tool-select").click(),!1}}],"ctrl+a meta+a":[{event:"keydown",ctxt:"edit",fn:function(){return t.project.activeLayer.children.map(function(e){e.selected=!0}),!1}},{event:"keydown",ctxt:"review",fn:function(){return!1}}],d:[{event:"keydown",ctxt:"edit",fn:function(){return e("#tool-drawing").click(),!1}}],f:[{event:"keydown",ctxt:"edit",fn:function(){return e("#tool-arrow").click(),!1}}],l:[{event:"keydown",ctxt:"edit",fn:function(){return e("#tool-lines").click(),!1}}],c:[{event:"keydown",ctxt:"edit",fn:function(){return e("#tool-ellipse").click(),!1}}],r:[{event:"keydown",ctxt:"edit",fn:function(){return e("#tool-rectangle").click(),!1}}],t:[{event:"keydown",ctxt:"edit",fn:function(){return e("#tool-text").click(),!1}}]}});
/*! AdIm - v3.0.1 - 2019-04-23 - Copyright (C) 2019 Université de Lausanne - see licence */
/*! AdIm - v3.0.1 - 2019-04-24 - Copyright (C) 2019 Université de Lausanne - see licence */
define('env/env',["jquery","underscore","paper","signals","adim/config","adim/view","adim/attributes","adim/io","adim/tools","adim/ui","adim/category","env/shortcuts"],function(d,e,n,a,o,r,c,t,i,p,l,s){var u={name:"geomo",shortcuts:s,initSignalRouting:function(){console.info("_initSignalRouting from env/geomo"),t.events.annotableLoaded.add(function(e){r.events.annotationRemoved.add(function(e){}),r.events.imageLoaded.add(function(e){})},100),r.events.annotationsLoaded.add(function(){},-100),p.events.modeChanged.add(function(e){var n=e.mode;"edit"===n?(d("#annotation-display-panel").hide(),d("#annotation-property-container .property-group").show()):"review"===n&&(d("#annotation-display-panel").show(),d("#annotation-property-container .property-group").hide(),d("#annotation-property-container .comment-prop").show())})},initUI:function(e){l.init({env:u.name}),d(".adim-display-type-selector").find("button").on("click",function(e){var n=d(this),a=!n.hasClass("active"),o=n.data("category");e.metaKey||(n.toggleClass("active",a),"image"===o?c.setImageOpacity(a?100:0,!0):r.toggleItemsByProp({prop:"category",val:o,undef:!0},a))}),d("#side-col");var n=d(".canvas-container"),a=d("#side-col-panel-group"),o=d("#alt-side-col-panel-group"),t=d("#shared-annotation-markers-panel");function i(e){o.toggleClass("hidden",!e),a.toggleClass("col-xs-12",!e).toggleClass("col-xs-6",e)}function s(e){i(e&&t.find(".panel-collapse").hasClass("in")),t.toggleClass("hidden",!e)}s("review"===e.mode),p.events.modeChanged.add(function(e){s("review"===e.mode),p.updateReservedSpace(),p.adjustCanvasToImage()}),t.find(".panel-collapse").on("hidden.bs.collapse",function(){n.css("transition","width 0.2s cubic-bezier(0.25, 0.1, 0.25, 1) 0s"),t.prependTo(a),i(!1),p.updateReservedSpace(),p.adjustCanvasToImage(),n.css("transition","")}).on("show.bs.collapse",function(){i(!0),t.appendTo(o),p.updateReservedSpace(),p.adjustCanvasToImage()})}};return Object.defineProperty(u,"style",{get:function(){}}),u});
/**
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