# HG changeset patch # User veltr # Date 1370532255 -7200 # Node ID a9040a7c47d9a6f4796d6ef368fe578aa0766c7b # Parent f7b5ae0d2681e36e2c4842e75e44cc775c3cbfaf Some changes for standalone app compatibility diff -r f7b5ae0d2681 -r a9040a7c47d9 client/css/renkan.css --- a/client/css/renkan.css Thu May 30 12:08:28 2013 +0200 +++ b/client/css/renkan.css Thu Jun 06 17:24:15 2013 +0200 @@ -140,7 +140,8 @@ border-style: none solid solid; border-width: 1px; border-color: #cccccc; border-bottom-left-radius: 2px; border-bottom-right-radius: 2px; } -.Rk-TopBar-Tooltip-Tip { +.Rk-TopBar-Tooltip:before { + content: "."; display: block; text-indent: -8000px; height: 7px; background: url(../img/tooltiparrow.png) center no-repeat; margin: 0 1px; } @@ -208,6 +209,21 @@ opacity: 1; background-position: -138px 0; } +.Rk-Home-Button { + width: 30px; background-position: -206px 0; +} + +.Rk-Home-Button:hover { + background-position: -206px -35px; +} + +.Rk-Open-Button { + width: 30px; background-position: -240px 0; +} + +.Rk-Open-Button:hover { + background-position: -240px -35px; +} /* Canvas */ .Rk-Editing-Space { diff -r f7b5ae0d2681 -r a9040a7c47d9 client/img/topbarbuttons.png Binary file client/img/topbarbuttons.png has changed diff -r f7b5ae0d2681 -r a9040a7c47d9 client/js/defaults.js --- a/client/js/defaults.js Thu May 30 12:08:28 2013 +0200 +++ b/client/js/defaults.js Thu Jun 06 17:24:15 2013 +0200 @@ -35,6 +35,17 @@ Set to 0 for delete confirm */ autoscale_padding: 50, + /* TOP BAR BUTTONS */ + show_user_list: true, + show_save_button: true, + show_open_button: false, + show_addnode_button: true, + show_addedge_button: true, + show_bookmarklet: true, + show_fullscreen_button: true, + home_button_url: false, + home_button_title: "Home", + /* MINI-MAP OPTIONS */ show_minimap: true, @@ -105,6 +116,7 @@ show_node_editor_color: true, show_node_editor_image: true, show_node_editor_creator: true, + uploaded_image_max_kb: 500, /* NODE TOOLTIP OPTIONS */ diff -r f7b5ae0d2681 -r a9040a7c47d9 client/js/i18n.js --- a/client/js/i18n.js Thu May 30 12:08:28 2013 +0200 +++ b/client/js/i18n.js Thu Jun 06 17:24:15 2013 +0200 @@ -13,7 +13,8 @@ "Full Screen": "Mode plein écran", "Add Node": "Ajouter un nœud", "Add Edge": "Ajouter un lien", - "Archive Project": "Archiver le projet", + "Save Project": "Enregistrer le projet", + "Open Project": "Ouvrir un projet", "Auto-save enabled": "Enregistrement automatique activé", "Connection lost": "Connexion perdue", "Created by:": "Créé par :", diff -r f7b5ae0d2681 -r a9040a7c47d9 client/js/paper-renderer.js --- a/client/js/paper-renderer.js Thu May 30 12:08:28 2013 +0200 +++ b/client/js/paper-renderer.js Thu Jun 06 17:24:15 2013 +0200 @@ -12,7 +12,6 @@ _CLICKMODE_ADDNODE = 1, _CLICKMODE_STARTEDGE = 2, _CLICKMODE_ENDEDGE = 3, - _IMAGE_MAX_KB = 500, _NODE_SIZE_STEP = Math.LN2/4, _MIN_SCALE = 1/20, _MAX_SCALE = 20, @@ -1006,8 +1005,8 @@ alert(_this.renkan.translate("This file is not an image")); return; } - if (f.size > (_IMAGE_MAX_KB * 1024)) { - alert(_this.renkan.translate("Image size must be under ")+_IMAGE_MAX_KB+_this.renkan.translate("KB")); + if (f.size > (_this.options.uploaded_image_max_kb * 1024)) { + alert(_this.renkan.translate("Image size must be under ") + _this.options.uploaded_image_max_kb + _this.renkan.translate("KB")); return; } fr.onload = function(e) { @@ -1572,7 +1571,7 @@ var throttledMouseMove = _.throttle(function(_event, _isTouch) { _this.onMouseMove(_event, _isTouch); }, _MOUSEMOVE_RATE); - + this.canvas_$.on({ mousedown: function(_event) { _event.preventDefault(); @@ -1704,67 +1703,27 @@ _this.dropData(res, _event.originalEvent); } }); - this.editor_$.find(".Rk-ZoomOut").click(function() { - var _newScale = _this.scale * Math.SQRT1_2, - _offset = new paper.Point([ - _this.canvas_$.width(), - _this.canvas_$.height() - ]).multiply( .5 * ( 1 - Math.SQRT1_2 ) ).add(_this.offset.multiply( Math.SQRT1_2 )); - _this.setScale( _newScale, _offset ); - }); - this.editor_$.find(".Rk-ZoomIn").click(function() { - var _newScale = _this.scale * Math.SQRT2, - _offset = new paper.Point([ - _this.canvas_$.width(), - _this.canvas_$.height() - ]).multiply( .5 * ( 1 - Math.SQRT2 ) ).add(_this.offset.multiply( Math.SQRT2 )); - _this.setScale( _newScale, _offset ); - }); + + var bindClick = function(selector, fname) { + _this.$.find(selector).click(function(evt) { + _this[fname](evt); + return false; + }); + } + + bindClick(".Rk-ZoomOut", "zoomOut"); + bindClick(".Rk-ZoomIn", "zoomIn"); this.$.find(".Rk-CurrentUser").mouseenter( function() { _this.$.find(".Rk-UserList").slideDown(); } ); this.$.find(".Rk-Users").mouseleave( function() { _this.$.find(".Rk-UserList").slideUp(); } ); - this.$.find(".Rk-FullScreen-Button").click(function() { - var _isFull = document.fullScreen || document.mozFullScreen || document.webkitIsFullScreen, - _el = _this.renkan.$[0], - _requestMethods = ["requestFullScreen","mozRequestFullScreen","webkitRequestFullScreen"], - _cancelMethods = ["cancelFullScreen","mozCancelFullScreen","webkitCancelFullScreen"]; - if (_isFull) { - for (var i = 0; i < _cancelMethods.length; i++) { - if (typeof document[_cancelMethods[i]] === "function") { - document[_cancelMethods[i]](); - break; - } - } - } else { - for (var i = 0; i < _requestMethods.length; i++) { - if (typeof _el[_requestMethods[i]] === "function") { - _el[_requestMethods[i]](); - break; - } - } - } - }); - this.$.find(".Rk-AddNode-Button").click(function() { - if (_this.click_mode === _CLICKMODE_ADDNODE) { - _this.click_mode = false; - _this.notif_$.hide(); - } else { - _this.click_mode = _CLICKMODE_ADDNODE; - _this.notif_$.text(_renkan.translate("Click on the background canvas to add a node")).fadeIn(); - } - }); - this.$.find(".Rk-AddEdge-Button").click(function() { - if (_this.click_mode === _CLICKMODE_STARTEDGE || _this.click_mode === _CLICKMODE_ENDEDGE) { - _this.click_mode = false; - _this.notif_$.hide(); - } else { - _this.click_mode = _CLICKMODE_STARTEDGE; - _this.notif_$.text(_renkan.translate("Click on a first node to start the edge")).fadeIn(); - } - }); + bindClick(".Rk-FullScreen-Button", "fullScreen"); + bindClick(".Rk-AddNode-Button", "addNodeBtn"); + bindClick(".Rk-AddEdge-Button", "addEdgeBtn"); + bindClick(".Rk-Save-Button", "save"); + bindClick(".Rk-Open-Button", "open"); this.$.find(".Rk-Bookmarklet-Button") .attr("href","javascript:" + _BOOKMARKLET_CODE(_renkan)) .click(function(){ @@ -1780,24 +1739,7 @@ }).mouseout(function() { Rkns.$(this).find(".Rk-TopBar-Tooltip").hide(); }); - this.$.find(".Rk-Fold-Bins").click(function() { - var bins = _renkan.$.find(".Rk-Bins"); - if (bins.offset().left < 0) { - bins.animate({left: 0},250); - _this.$.animate({left: 300},250,function() { - var w = _this.$.width(); - paper.view.viewSize = new paper.Size([w, _this.canvas_$.height()]); - }); - $(this).html("«"); - } else { - bins.animate({left: -300},250); - _this.$.animate({left: 0},250,function() { - var w = _this.$.width(); - paper.view.viewSize = new paper.Size([w, _this.canvas_$.height()]); - }); - $(this).html("»"); - } - }); + bindClick(".Rk-Fold-Bins", "foldBins"); paper.view.onResize = function(_event) { _this.offset = _this.offset.add(_event.delta.divide(2)); @@ -1902,14 +1844,19 @@ template: Rkns._.template( '<% if (options.show_top_bar) { %>