# HG changeset patch # User ymh # Date 1430148166 -7200 # Node ID e529b633c3399d6b3471b76c2638a0a9d1463539 # Parent 0d5998b32a7ce26675bf079c84d1e79568156b9e Add shape management, correction on shape manip[ulation on the client, correct 404 error on space creation, increment version diff -r 0d5998b32a7c -r e529b633c339 client/bower.json --- a/client/bower.json Sat Apr 25 04:37:06 2015 +0200 +++ b/client/bower.json Mon Apr 27 17:22:46 2015 +0200 @@ -31,9 +31,14 @@ "FileSaver": "*", "backbone-relational": "~0.9.0", "requirejs": null, - "lodash": "2.4.1" + "lodash": "~2.4.1" }, "devDependencies": { "jquery-ui": "~1.11.4" + }, + "exportsOverride": { + "lodash": { + "": "dist/*.js" + } } } diff -r 0d5998b32a7c -r e529b633c339 client/css/renkan.css --- a/client/css/renkan.css Sat Apr 25 04:37:06 2015 +0200 +++ b/client/css/renkan.css Mon Apr 27 17:22:46 2015 +0200 @@ -383,7 +383,7 @@ } .Rk-Edit-Image{ - font-size: 12px; width: 230px; + font-size: 12px; width: 220px; } .Rk-Edit-Image-Del{ @@ -398,7 +398,7 @@ } .Rk-Edit-URI { - font-size: 12px; width: 230px; + font-size: 12px; width: 220px; } .Rk-Edit-ImgWrap { diff -r 0d5998b32a7c -r e529b633c339 client/js/header.js --- a/client/js/header.js Sat Apr 25 04:37:06 2015 +0200 +++ b/client/js/header.js Mon Apr 27 17:22:46 2015 +0200 @@ -1,24 +1,25 @@ -/*! - * _____ _ - * | __ \ | | - * | |__) |___ _ __ | | ____ _ _ __ - * | _ // _ \ '_ \| |/ / _` | '_ \ +/*! + * _____ _ + * | __ \ | | + * | |__) |___ _ __ | | ____ _ _ __ + * | _ // _ \ '_ \| |/ / _` | '_ \ * | | \ \ __/ | | | < (_| | | | | * |_| \_\___|_| |_|_|\_\__,_|_| |_| * - * Copyright 2012-2013 Institut de recherche et d'innovation - * contributor(s) : Yves-Marie Haussonne, Raphael Velt, Samuel Huron - * + * Copyright 2012-2015 Institut de recherche et d'innovation + * contributor(s) : Yves-Marie Haussonne, Raphael Velt, Samuel Huron, + * Thibaut Cavalié, Julien Rougeron. + * * contact@iri.centrepompidou.fr - * http://www.iri.centrepompidou.fr - * + * http://www.iri.centrepompidou.fr + * * This software is a computer program whose purpose is to show and add annotations on a video . * This software is governed by the CeCILL-C license under French law and - * abiding by the rules of distribution of free software. You can use, + * abiding by the rules of distribution of free software. You can use, * modify and/ or redistribute the software under the terms of the CeCILL-C * license as circulated by CEA, CNRS and INRIA at the following URL - * "http://www.cecill.info". - * + * "http://www.cecill.info". + * * The fact that you are presently reading this means that you have had * knowledge of the CeCILL-C license and that you accept its terms. - */ \ No newline at end of file + */ diff -r 0d5998b32a7c -r e529b633c339 client/js/models.js --- a/client/js/models.js Sat Apr 25 04:37:06 2015 +0200 +++ b/client/js/models.js Mon Apr 27 17:22:46 2015 +0200 @@ -100,7 +100,9 @@ .get("_id") : null, size : this.get("size"), clip_path : this.get("clip_path"), - shape : this.get("shape") + shape : this.get("shape"), + type : this.get("type"), + hidden : this.get("hidden") }; } }); diff -r 0d5998b32a7c -r e529b633c339 client/js/renderer/baserepresentation.js --- a/client/js/renderer/baserepresentation.js Sat Apr 25 04:37:06 2015 +0200 +++ b/client/js/renderer/baserepresentation.js Mon Apr 27 17:22:46 2015 +0200 @@ -18,7 +18,7 @@ if (this.model) { var _this = this; this._changeBinding = function() { - _this.redraw(); + _this.redraw({change: true}); }; this._removeBinding = function() { _renderer.removeRepresentation(_this); diff -r 0d5998b32a7c -r e529b633c339 client/js/renderer/nodeeditor.js --- a/client/js/renderer/nodeeditor.js Sat Apr 25 04:37:06 2015 +0200 +++ b/client/js/renderer/nodeeditor.js Mon Apr 27 17:22:46 2015 +0200 @@ -9,11 +9,11 @@ var NodeEditor = Utils.inherit(BaseEditor); _(NodeEditor.prototype).extend({ - _init: function() { - BaseEditor.prototype._init.apply(this); - this.template = this.options.templates['templates/nodeeditor.html']; - this.readOnlyTemplate = this.options.templates['templates/nodeeditor_readonly.html']; - }, + _init: function() { + BaseEditor.prototype._init.apply(this); + this.template = this.options.templates['templates/nodeeditor.html']; + this.readOnlyTemplate = this.options.templates['templates/nodeeditor_readonly.html']; + }, draw: function() { var _model = this.source_representation.model, _created_by = _model.get("created_by") || Utils._USER_PLACEHOLDER(this.renkan), @@ -44,6 +44,17 @@ this.redraw(); var _this = this, closeEditor = function() { + _this.editor_$.off("keyup"); + _this.editor_$.find("input, textarea, select").off("change keyup paste"); + _this.editor_$.find(".Rk-Edit-Image-File").off('change'); + _this.editor_$.find(".Rk-Edit-ColorPicker-Wrapper").off('hover'); + _this.editor_$.find(".Rk-Edit-Size-Down").off('click'); + _this.editor_$.find(".Rk-Edit-Size-Up").off('click'); + _this.editor_$.find(".Rk-Edit-Image-Del").off('click'); + _this.editor_$.find(".Rk-Edit-ColorPicker").find("li").off('hover click'); + _this.editor_$.find(".Rk-CloseX").off('click'); + _this.editor_$.find(".Rk-Edit-Goto").off('click'); + _this.renderer.removeRepresentation(_this); paper.view.draw(); }; @@ -78,15 +89,10 @@ if (_this.options.change_shapes) { if(_model.get("shape")!==_this.editor_$.find(".Rk-Edit-Shape").val()){ _data.shape = _this.editor_$.find(".Rk-Edit-Shape").val(); - _data.shape_changed = true; } } _model.set(_data); _this.redraw(); - // For an unknown reason, we have to set data twice when we change shape, otherwise the image disappears. - if(_data.shape_changed===true){ - _model.set(_data); - } } else { closeEditor(); } @@ -178,8 +184,8 @@ }); this.editor_$.find(".Rk-Edit-Image-Del").click(function() { - _this.editor_$.find(".Rk-Edit-Image").val(''); - onFieldChange(); + _this.editor_$.find(".Rk-Edit-Image").val(''); + onFieldChange(); return false; }); } else { diff -r 0d5998b32a7c -r e529b633c339 client/js/renderer/noderepr.js --- a/client/js/renderer/noderepr.js Sat Apr 25 04:37:06 2015 +0200 +++ b/client/js/renderer/noderepr.js Mon Apr 27 17:22:46 2015 +0200 @@ -56,8 +56,7 @@ } }, buildShape: function(){ - if(typeof this.model.get("shape_changed")!=="undefined" && this.model.get("shape_changed")===true){ - this.model.set("shape_changed", false); + if( 'shape' in this.model.changed ) { delete this.img; } if(this.circle){ @@ -68,14 +67,16 @@ this.shapeBuilder = new ShapeBuilder(this.model.get("shape")); this.circle = this.shapeBuilder.getShape(); this.circle.__representation = this; + this.circle.sendToBack(); this.last_circle_radius = 1; }, - redraw: function(_dontRedrawEdges) { - if(typeof this.model.get("shape_changed")!=="undefined" && this.model.get("shape_changed")===true){ + redraw: function(options) { + if( 'shape' in this.model.changed && 'change' in options && options.change ) { + //if( 'shape' in this.model.changed ) { this.buildShape(); } var _model_coords = new paper.Point(this.model.get("position")), - _baseRadius = this.options.node_size_base * Math.exp((this.model.get("size") || 0) * Utils._NODE_SIZE_STEP); + _baseRadius = this.options.node_size_base * Math.exp((this.model.get("size") || 0) * Utils._NODE_SIZE_STEP); if (!this.is_dragging || !this.paper_coords) { this.paper_coords = this.renderer.toPaperCoords(_model_coords); } @@ -151,6 +152,9 @@ this.img = this.model.get("image"); if (this.img && this.img !== lastImage) { this.showImage(); + if(this.circle) { + this.circle.sendToBack(); + } } if (this.node_image && !this.img) { this.node_image.remove(); @@ -165,7 +169,7 @@ this.minimap_circle.fitBounds(minipos.subtract(minisize), minisize.multiply(2)); } - if (!_dontRedrawEdges) { + if (typeof options === 'undefined' || !('dontRedrawEdges' in options) || !options.dontRedrawEdges) { var _this = this; _.each( this.project.get("edges").filter( @@ -304,8 +308,7 @@ this.node_image.__representation = _this; this.node_image.scale(this.circle_radius / baseRadius); this.node_image.position = this.paper_coords.subtract(this.image_delta.multiply(this.circle_radius)); - this.redraw(); - this.renderer.throttledPaperDraw(); + this.node_image.insertAbove(this.circle); } else { var _this = this; $(_image).on("load", function() { diff -r 0d5998b32a7c -r e529b633c339 client/js/renderer/scene.js --- a/client/js/renderer/scene.js Sat Apr 25 04:37:06 2015 +0200 +++ b/client/js/renderer/scene.js Mon Apr 27 17:22:46 2015 +0200 @@ -833,7 +833,7 @@ return; } _.each(this.representations, function(_representation) { - _representation.redraw(true); + _representation.redraw({ dontRedrawEdges:true }); }); if (this.minimap) { this.redrawMiniframe(); diff -r 0d5998b32a7c -r e529b633c339 client/js/renderer/shapebuilder.js --- a/client/js/renderer/shapebuilder.js Sat Apr 25 04:37:06 2015 +0200 +++ b/client/js/renderer/shapebuilder.js Mon Apr 27 17:22:46 2015 +0200 @@ -39,12 +39,12 @@ }, "diamond":{ getShape: function() { - var d = new paper.Path.Rectangle([-2, -2], [2, 2]); + var d = new paper.Path.Rectangle([-Math.SQRT2, -Math.SQRT2], [Math.SQRT2, Math.SQRT2]); d.rotate(45); return d; }, getImageShape: function(center, radius) { - var d = new paper.Path.Rectangle([-radius, -radius], [radius*2, radius*2]); + var d = new paper.Path.Rectangle([-radius*Math.SQRT2/2, -radius*Math.SQRT2/2], [radius*Math.SQRT2, radius*Math.SQRT2]); d.rotate(45); return d; } @@ -63,15 +63,15 @@ return new paper.Path(path); }, getImageShape: function(center, radius) { - // No calcul for the moment + // No calcul for the moment return new paper.Path(); } }; } }; - + var ShapeBuilder = function (shape){ - if(typeof shape==="undefined"){ + if(shape === null || typeof shape === "undefined"){ shape = "circle"; } if(shape.substr(0,4)==="svg:"){ @@ -82,7 +82,7 @@ } return builders[shape]; }; - + return ShapeBuilder; }); diff -r 0d5998b32a7c -r e529b633c339 client/package.json --- a/client/package.json Sat Apr 25 04:37:06 2015 +0200 +++ b/client/package.json Mon Apr 27 17:22:46 2015 +0200 @@ -1,6 +1,6 @@ { "name": "renkan", - "version": "0.8.7", + "version": "0.9.0", "description": "Renkan client application", "repository": { "type": "hg", diff -r 0d5998b32a7c -r e529b633c339 server/java/build.gradle --- a/server/java/build.gradle Sat Apr 25 04:37:06 2015 +0200 +++ b/server/java/build.gradle Mon Apr 27 17:22:46 2015 +0200 @@ -2,7 +2,7 @@ apply plugin: 'maven' group = 'org.iri_research.renkan' - version = '0.8.7' + version = '0.9.0' gradle.projectsEvaluated { @@ -17,7 +17,7 @@ junit_version = '4.11' slf4j_log4j12_version = '1.7.5' - spring_version = '3.2.6.RELEASE' + spring_version = '3.2.9.RELEASE' javax_servlet_version = '3.0.1' java_inject_version = '1' commons_codec_version = '1.8' diff -r 0d5998b32a7c -r e529b633c339 server/java/pom.xml --- a/server/java/pom.xml Sat Apr 25 04:37:06 2015 +0200 +++ b/server/java/pom.xml Mon Apr 27 17:22:46 2015 +0200 @@ -5,7 +5,7 @@ org.iri_research.renkan renkan pom - 0.8.7 + 0.9.0 Renkan project diff -r 0d5998b32a7c -r e529b633c339 server/java/renkan-core/pom.xml --- a/server/java/renkan-core/pom.xml Sat Apr 25 04:37:06 2015 +0200 +++ b/server/java/renkan-core/pom.xml Mon Apr 27 17:22:46 2015 +0200 @@ -12,7 +12,7 @@ renkan-core http://maven.apache.org - 3.2.6.RELEASE + 3.2.9.RELEASE 1.3.3.RELEASE 1.6.3.RELEASE 1.4.3.RELEASE diff -r 0d5998b32a7c -r e529b633c339 server/java/renkan-core/src/main/java/org/iri_research/renkan/models/Node.java --- a/server/java/renkan-core/src/main/java/org/iri_research/renkan/models/Node.java Sat Apr 25 04:37:06 2015 +0200 +++ b/server/java/renkan-core/src/main/java/org/iri_research/renkan/models/Node.java Mon Apr 27 17:22:46 2015 +0200 @@ -19,7 +19,8 @@ public Node(Node node, String projectId) { this(Constants.UUID_GENERATOR.generate().toString(), node.title, node.description, node.uri, node.color, node.createdBy, - node.position, node.image, node.size, projectId); + node.position, node.image, node.size, node.shape, node.type, + node.hidden, projectId); } public Node(Node node) { @@ -33,7 +34,8 @@ @Autowired(required = true) public Node(String id, String title, String description, String uri, String color, String createdBy, Point position, String image, - Integer size, String projectId) { + Integer size, String shape, String type, Boolean hidden, + String projectId) { super(id, title, description, uri, color); this.projectId = projectId; @@ -41,6 +43,9 @@ this.position = position; this.image = image; this.size = (size == null) ? 0 : size.intValue(); + this.shape = shape; + this.type = type; + this.hidden = (hidden == null) ? false : hidden.booleanValue(); } @Field("project_id") @@ -57,6 +62,12 @@ private int size; + private String shape; + + private String type; + + private boolean hidden; + public Point getPosition() { return position; } @@ -69,7 +80,7 @@ public String getProjectId() { return projectId; } - + public void setProjectId(String projectId) { this.projectId = projectId; } @@ -83,6 +94,18 @@ return size; } + public String getShape() { + return shape; + } + + public String getType() { + return type; + } + + public boolean isHidden() { + return hidden; + } + @Override protected String getRawKeyPart() { return this.createdBy; diff -r 0d5998b32a7c -r e529b633c339 server/java/renkan-core/src/test/java/org/iri_research/renkan/test/repositories/ProjectsRepositoryTest.java --- a/server/java/renkan-core/src/test/java/org/iri_research/renkan/test/repositories/ProjectsRepositoryTest.java Sat Apr 25 04:37:06 2015 +0200 +++ b/server/java/renkan-core/src/test/java/org/iri_research/renkan/test/repositories/ProjectsRepositoryTest.java Mon Apr 27 17:22:46 2015 +0200 @@ -144,7 +144,8 @@ Node node = new Node("Node" + i, "Node" + i, "Node " + i, "http://renkan.org/nodes/node" + i, "#ffff0" + i, "test_user", new Point(0, i), - "http://renkan.org/images/node" + i, i, copyProject.getId()); + "http://renkan.org/images/node" + i, i, "circle", "Node", + false, copyProject.getId()); node = this.nodesRepository.save(node); copyProject.getNodes().add(node); this.testNodes.add(node); diff -r 0d5998b32a7c -r e529b633c339 server/java/renkan-web/src/main/java/org/iri_research/renkan/coweb/event/NodeSyncEventManager.java --- a/server/java/renkan-web/src/main/java/org/iri_research/renkan/coweb/event/NodeSyncEventManager.java Sat Apr 25 04:37:06 2015 +0200 +++ b/server/java/renkan-web/src/main/java/org/iri_research/renkan/coweb/event/NodeSyncEventManager.java Mon Apr 27 17:22:46 2015 +0200 @@ -72,20 +72,25 @@ String image = (String) values.get("image"); String node_id = (String) values.get("id"); - + //check that node id is unique if(this.getNodesRepository().exists(node_id)) { throw new CowebException("node insert: node exists", String.format("node %s already exists", node_id)); } - + Integer size = (Integer) values.get("size"); + String shape = (String) values.get("shape"); + String type = (String) values.get("type"); + Boolean hidden = (Boolean) values.get("hidden"); + + Node node = new Node(node_id, (String) values.get("title"), (String) values.get("description"), (String) values.get("uri"), (String) values.get("color"), creator_id, nodePosition, image, - size, project_id); + size, shape, type, hidden, project_id); Integer position = (Integer) data.get("position"); @@ -123,9 +128,9 @@ String project_id = (String) values.get("_project_id"); String node_id = (String) values.get("id"); - + Node node = this.getNodesRepository().findOne(node_id); - + if(node==null) { return true; } @@ -136,7 +141,7 @@ return false; } } - + @Override protected void checkUpdate(String clientId, Map data) { @@ -152,5 +157,5 @@ } } - + } diff -r 0d5998b32a7c -r e529b633c339 server/java/renkan-web/src/main/webapp/WEB-INF/templates/projectIndex.html --- a/server/java/renkan-web/src/main/webapp/WEB-INF/templates/projectIndex.html Sat Apr 25 04:37:06 2015 +0200 +++ b/server/java/renkan-web/src/main/webapp/WEB-INF/templates/projectIndex.html Mon Apr 27 17:22:46 2015 +0200 @@ -8,10 +8,10 @@ - + - + @@ -30,11 +30,11 @@
-
Create a Renkan
+
Create a Renkan
-
+
@@ -42,8 +42,8 @@

Project list

-
- + +
@@ -59,7 +59,7 @@ 6 ... > - >> + >>
@@ -91,12 +91,12 @@
  • View project
  • Export project
  • - +
    © 2014 IRI - Version 0.0
    -
    + - + - +
    @@ -25,7 +25,7 @@

    Renkan Spaces

    -
    Create a Space
    +
    Create a Space
    @@ -35,7 +35,7 @@

    Space list

    -
    +
    << < ... @@ -46,7 +46,7 @@ 6 ... > - >> + >>
    @@ -66,7 +66,7 @@ -
    Open space
    +