# HG changeset patch # User ymh # Date 1426614816 -3600 # Node ID 96781c1a8bbea03296379b218212ff820b34f735 # Parent c8eaff36abc785eb90ca2a550a06fc081a5812bd correct resizing problems especially in next firefox diff -r c8eaff36abc7 -r 96781c1a8bbe client/README.md --- a/client/README.md Fri Mar 13 16:46:50 2015 +0100 +++ b/client/README.md Tue Mar 17 18:53:36 2015 +0100 @@ -323,6 +323,3 @@ For read only examples, it appears that for security reasons urls like file:///path/to/folder/test-readonly-\*.html only work on Firefox. To see those examples with other browsers, you also need to run a localhost server and go to a url like http://localhost/renkan/test/test-readonly-\*.html. - -## Note -There is currently a bug when hovering diff -r c8eaff36abc7 -r 96781c1a8bbe client/css/renkan.css --- a/client/css/renkan.css Fri Mar 13 16:46:50 2015 +0100 +++ b/client/css/renkan.css Tue Mar 17 18:53:36 2015 +0100 @@ -1,24 +1,24 @@ -/*! - * _____ _ - * | __ \ | | - * | |__) |___ _ __ | | ____ _ _ __ - * | _ // _ \ '_ \| |/ / _` | '_ \ +/*! + * _____ _ + * | __ \ | | + * | |__) |___ _ __ | | ____ _ _ __ + * | _ // _ \ '_ \| |/ / _` | '_ \ * | | \ \ __/ | | | < (_| | | | | * |_| \_\___|_| |_|_|\_\__,_|_| |_| * - * Copyright 2012-2013 Institut de recherche et d'innovation + * Copyright 2012-2013 Institut de recherche et d'innovation * contributor(s) : Yves-Marie Haussonne, Raphael Velt, Samuel Huron - * + * * 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. */ @@ -39,7 +39,7 @@ } .Rk-Main input::-moz-focus-inner /*Remove button padding in FF*/ -{ +{ border: 0; padding: 0; } @@ -317,6 +317,10 @@ position: absolute; left: 0; top: 0; right: 0; bottom: 0; z-index: 2; } +.Rk-Canvas[resize] { + width: 100%; height:100%; +} + /* Node Labels */ .Rk-Highlighted { @@ -587,7 +591,7 @@ -webkit-appearance: none; -webkit-box-sizing: content-box; -moz-box-sizing: content-box; - box-sizing: content-box; + box-sizing: content-box; } .Rk-Web-Search-Input { @@ -788,4 +792,4 @@ h4.Rk-Bin-Loading { margin: 10px; text-align: center; font-size: 20px; color: #999999; -} \ No newline at end of file +} diff -r c8eaff36abc7 -r 96781c1a8bbe client/js/defaults.js --- a/client/js/defaults.js Fri Mar 13 16:46:50 2015 +0100 +++ b/client/js/defaults.js Tue Mar 17 18:53:36 2015 +0100 @@ -36,6 +36,7 @@ /* Delay between clicking on the bin on an element and really deleting it Set to 0 for delete confirm */ autoscale_padding: 50, + resize: true, default_view: false, /* Allows to load default view (zoom+offset) at start on read_only mode, instead of autoScale. default_view has to be an integer 0,1,2... */ diff -r c8eaff36abc7 -r 96781c1a8bbe client/js/renderer/noderepr.js --- a/client/js/renderer/noderepr.js Fri Mar 13 16:46:50 2015 +0100 +++ b/client/js/renderer/noderepr.js Tue Mar 17 18:53:36 2015 +0100 @@ -198,12 +198,12 @@ } this.renderer.node_layer.activate(); var width = _image.width, - height = _image.height, - clipPath = this.model.get("clip_path"), - hasClipPath = (typeof clipPath !== "undefined" && clipPath), - _clip = null, - baseRadius = null, - centerPoint = null; + height = _image.height, + clipPath = this.model.get("clip_path"), + hasClipPath = (typeof clipPath !== "undefined" && clipPath), + _clip = null, + baseRadius = null, + centerPoint = null; if (hasClipPath) { _clip = new paper.Path(); diff -r c8eaff36abc7 -r 96781c1a8bbe client/js/renderer/scene.js --- a/client/js/renderer/scene.js Fri Mar 13 16:46:50 2015 +0100 +++ b/client/js/renderer/scene.js Tue Mar 17 18:53:36 2015 +0100 @@ -30,9 +30,6 @@ this.delete_list = []; this.redrawActive = true; - var currentWidth = this.canvas_$.width(); - var currentHeight = this.canvas_$.height(); - if (_renkan.options.show_minimap) { this.minimap = { background_layer: new paper.Layer(), @@ -60,7 +57,7 @@ this.minimap.miniframe.fillColor = '#c0c0ff'; this.minimap.miniframe.opacity = 0.3; this.minimap.miniframe.strokeColor = '#000080'; - this.minimap.miniframe.strokeWidth = 3; + this.minimap.miniframe.strokeWidth = 2; this.minimap.miniframe.__representation = new MiniFrame(this, null); } @@ -280,13 +277,8 @@ paper.view.onResize = function(_event) { var _ratio, - newWidth= _this.canvas_$.parent().width(), - newHeight = _this.canvas_$.parent().height(); - // Because of paper bug which does not calculate the good height and width - // We have to update manually the canvas's height and width - - paper.view._viewSize.height = _event.size.height = _this.canvas_$.parent().height(); - paper.view._viewSize.width = _event.size.height = _this.canvas_$.parent().width(); + newWidth = _event.width, + newHeight = _event.height; if (_this.minimap) { _this.minimap.topleft = paper.view.bounds.bottomRight.subtract(_this.minimap.size); @@ -294,16 +286,15 @@ _this.minimap.cliprectangle.fitBounds(_this.minimap.topleft, _this.minimap.size); } + var ratioH = newHeight/(newHeight-_event.delta.height), + ratioW = newWidth/(newWidth-_event.delta.width); if (newHeight < newWidth) { - _ratio = (newHeight/currentHeight); + _ratio = ratioH; } else { - _ratio = (newWidth/currentWidth); + _ratio = ratioW; } - _this.resizeZoom((newWidth/currentWidth), (newHeight/currentHeight), _ratio); - - currentWidth = newWidth; - currentHeight = newHeight; + _this.resizeZoom(ratioW, ratioH, _ratio); _this.redraw(); @@ -522,7 +513,7 @@ 'if (options.show_search_field) { %>' + '
" />
<% } %><% } %>' + '
' + - '
' + + '
resize="" <% } %>>
' + '<% if (options.show_bins) { %>
«
<% } %>' + '
">
">
">
' + '<% if (options.editor_mode) { %>
">
<% } %>' + @@ -530,17 +521,6 @@ '
' ), fixSize: function(_autoscale) { - var w = this.$.width(), - h = this.$.height(); - if (this.renkan.options.show_top_bar) { - h -= this.$.find(".Rk-TopBar").height(); - } - this.canvas_$.attr({ - width: w, - height: h - }); - - paper.view.viewSize = new paper.Size([w, h]); if (_autoscale) { // If _autoscale, we get the initial view (zoom+offset) set in the project datas. @@ -734,18 +714,18 @@ }, redrawMiniframe: function() { var topleft = this.toMinimapCoords(this.toModelCoords(new paper.Point([0,0]))), - bottomright = this.toMinimapCoords(this.toModelCoords(paper.view.bounds.bottomRight)); + bottomright = this.toMinimapCoords(this.toModelCoords(paper.view.bounds.bottomRight)); this.minimap.miniframe.fitBounds(topleft, bottomright); }, rescaleMinimap: function() { var nodes = this.renkan.project.get("nodes"); if (nodes.length > 1) { var _xx = nodes.map(function(_node) { return _node.get("position").x; }), - _yy = nodes.map(function(_node) { return _node.get("position").y; }), - _minx = Math.min.apply(Math, _xx), - _miny = Math.min.apply(Math, _yy), - _maxx = Math.max.apply(Math, _xx), - _maxy = Math.max.apply(Math, _yy); + _yy = nodes.map(function(_node) { return _node.get("position").y; }), + _minx = Math.min.apply(Math, _xx), + _miny = Math.min.apply(Math, _yy), + _maxx = Math.max.apply(Math, _xx), + _maxy = Math.max.apply(Math, _yy); var _scale = Math.min( this.scale * 0.8 * this.renkan.options.minimap_width / paper.view.bounds.width, this.scale * 0.8 * this.renkan.options.minimap_height / paper.view.bounds.height, @@ -1186,10 +1166,10 @@ }, fullScreen: function() { var _isFull = document.fullScreen || document.mozFullScreen || document.webkitIsFullScreen, - _el = this.renkan.$[0], - _requestMethods = ["requestFullScreen","mozRequestFullScreen","webkitRequestFullScreen"], - _cancelMethods = ["cancelFullScreen","mozCancelFullScreen","webkitCancelFullScreen"], - i; + _el = this.renkan.$[0], + _requestMethods = ["requestFullScreen","mozRequestFullScreen","webkitRequestFullScreen"], + _cancelMethods = ["cancelFullScreen","mozCancelFullScreen","webkitCancelFullScreen"], + i; if (_isFull) { for (i = 0; i < _cancelMethods.length; i++) { if (typeof document[_cancelMethods[i]] === "function") { @@ -1207,12 +1187,7 @@ widthAft -= this.renkan.$.find(".Rk-Bins").width(); } - this.canvas_$.attr({ - width: widthAft, - height: heightAft - }); - - paper.view.viewSize = new paper.Size([this.canvas_$.width(), this.canvas_$.height()]); + paper.view.viewSize = new paper.Size([widthAft, heightAft]); } else { for (i = 0; i < _requestMethods.length; i++) { @@ -1221,6 +1196,7 @@ break; } } + this.redraw(); } }, zoomOut: function() { diff -r c8eaff36abc7 -r 96781c1a8bbe client/test/test-writable-simple-div.html --- a/client/test/test-writable-simple-div.html Fri Mar 13 16:46:50 2015 +0100 +++ b/client/test/test-writable-simple-div.html Tue Mar 17 18:53:36 2015 +0100 @@ -28,7 +28,7 @@ user_id: "u-iri", language: "fr", node_fill_color: false*/ - show_bins: false, + show_bins: false, static_url: "../" }); Rkns.jsonIO(_renkan, {