diff --git a/main.py b/main.py index 6013dd4..4db2f42 100644 --- a/main.py +++ b/main.py @@ -7,7 +7,6 @@ import os import pyutil app = Flask(__name__) -CORS(app) controller = None @app.route("/update_project") @@ -55,6 +54,7 @@ def setup_controller(): def setup_static_files_service(app): if not app.config['APACHE_HOST']: + CORS(app) @app.route("/") def send_static_files(path): root_dir = os.path.abspath(os.path.dirname(__file__)) diff --git a/view/assets/css/main.css b/view/assets/css/main.css index 76033e9..5eaf02c 100644 --- a/view/assets/css/main.css +++ b/view/assets/css/main.css @@ -317,11 +317,8 @@ ul.rig.columns-4 li { width: 20%; } -.selection-panel-body[mainconfig=right-hand] ul.rig.columns-2 li { - width: 60%; -} - -.selection-panel-body[mainconfig=left-hand] ul.rig.columns-2 li { +.selection-panel-body[mainconfig=right-hand] ul.rig.columns-1 li, + .selection-panel-body[mainconfig=left-hand] ul.rig.columns-1 li { width: 60%; } @@ -373,10 +370,15 @@ ul.rig.columns-4 li { /* Sub-Configuration Panel */ .subconfiguration-options { - overflow-x: hidden; + overflow-x: scroll; white-space: nowrap; } +.subconfiguration-options-container { + height: 45px; + overflow: hidden; +} + .subconfiguration-panel { display: none; padding: 10px; diff --git a/view/assets/js/defaultConfigurationHandler.js b/view/assets/js/defaultConfigurationHandler.js new file mode 100644 index 0000000..04b4e05 --- /dev/null +++ b/view/assets/js/defaultConfigurationHandler.js @@ -0,0 +1,13 @@ +(function(defaultConfigurationHandler, $, undefined) { + + defaultConfigurationHandler.setup = function(hand, subConfig, step) { + var baseId = '.selection-panel-body[mainConfig=' + hand + '][subConfig=' + + subConfig + '][step=' + step + ']'; + $(baseId + ' .selection-panel-option').off('click').on( + 'click', function() { + wikilibras.selectAnOption(baseId, this); + dynworkflow.userSelectedAnOption(); + }); + }; + +}(window.defaultConfigurationHandler = window.defaultConfigurationHandler || {}, jQuery)); diff --git a/view/assets/js/dynamic-selection-workflow.js b/view/assets/js/dynamic-selection-workflow.js index 47a0262..83bce20 100644 --- a/view/assets/js/dynamic-selection-workflow.js +++ b/view/assets/js/dynamic-selection-workflow.js @@ -101,9 +101,10 @@ } function _selectSubConfig(subConfig) { - if (currentSubConfigName == 'movimento') { + /*if (subConfig != 'movimento' && + currentSubConfigName == 'movimento') { _updateAndGetFirstMovementSubConfig(); - } + }*/ currentSubConfigName = subConfig; currentSubconfig = currentSubconfigParent[currentSubConfigName]; currentStep = 0; @@ -112,14 +113,14 @@ // It shows the next selection panel on the workflow function _showNextSubConfig() { - _walkOnTheWorklow(true); + _walkOnTheWorkflow(true); } function _showPreviousSubConfig() { - _walkOnTheWorklow(false); + _walkOnTheWorkflow(false); } - function _walkOnTheWorklow(toForward) { + function _walkOnTheWorkflow(toForward) { currentStep = toForward ? currentStep + 1 : currentStep - 1; if (currentStep >= 0 && currentStep < currentSubconfig.length) { @@ -127,7 +128,7 @@ } else { var nextSubConfig = _getNextSubConfig(toForward); if (nextSubConfig != -1) { - dynworkflow.selectSubConfig(nextSubConfig); + _selectSubConfig(nextSubConfig); } else { wikilibras.hideSelectionPanel(); } @@ -144,17 +145,19 @@ // Timeline functions function _selectTimelineIcon(mainConfig, subConfig) { - var icon_id = '.subconfiguration-panel[mainConfig=' + mainConfig + - '] .icon_container[json_name=' + subConfig + ']'; + var baseId = '.subconfiguration-panel[mainConfig=' + mainConfig + '] .subconfiguration-options'; + var iconContainer = '.icon_container[json_name=' + subConfig + ']'; + var iconId = baseId + ' ' + iconContainer; - var previousSelected = $('.subconfiguration-panel[mainConfig=' + mainConfig + - '] .icon_container[select=true]').attr('json_name'); + var previousSelected = $(baseId + ' .icon_container[select=true]').attr('json_name'); if (typeof previousSelected != 'undefined') { _deselectTimelineIcon(mainConfig, previousSelected); } - wikilibras.enableIconHover($(icon_id), true); - $(icon_id).attr('select', true); + wikilibras.enableIconHover($(iconId), true); + $(iconId).attr('select', true); + // scrollTo icon + $(baseId).scrollTo(iconContainer, {'offset': -60, 'duration': 750}); } function _deselectTimelineIcon(mainConfig, subConfig) { @@ -197,9 +200,14 @@ }); } - function _setupTimelineIcons(timelineBaseId) { + function _setupTimelineIcons(timelineBaseId, toUpdate) { + if (!toUpdate) { + $(timelineBaseId).show(); + $(timelineBaseId + " .subconfiguration-options").scrollTo(0, 0); + return; + } + $(timelineBaseId + ' .icon_container[json_name]').attr("active", "false"); - for (var name in currentSubconfigParent) { $(timelineBaseId + ' .icon_container[json_name=' + name + ']').attr("active", "true"); } @@ -207,21 +215,20 @@ if (preprocessedMainConfig == 'hand') { $(timelineBaseId + ' .icon_container[json_name=movimento]').attr("active", "true"); _setupCheckIcon(mainConfig, 'movimento'); - _selectTimelineIcon(mainConfig, currentSubConfigName); } - + _selectTimelineIcon(mainConfig, currentSubConfigName); _setupTimelineListeners(timelineBaseId); $(timelineBaseId).show(); } - function _setupTimeline() { + function _setupTimeline(toUpdate) { var timelineBaseId = '.subconfiguration-panel[mainConfig=' + mainConfig + ']'; if (_isTimelineLoaded()) { - $(timelineBaseId).show(); + _setupTimelineIcons(timelineBaseId, toUpdate); } else { dynengine.render(baseUrl, '/' + preprocessedMainConfig + '/timeline.html', '#selection-panel', false, function() { - _setupTimelineIcons(timelineBaseId); + _setupTimelineIcons(timelineBaseId, true); }); } } @@ -236,9 +243,12 @@ currentStep = 0; _showCurrentSubconfig(); + }; + + dynworkflow.finishMainConfigSetup = function(subConfig) { // hide the timeline on the first subconfiguration for "hand" if (preprocessedMainConfig != 'hand' || _isTimelineLoaded()) { - _setupTimeline(); + _setupTimeline(false); } }; @@ -250,13 +260,13 @@ currentStep = 0; _showCurrentSubconfig(); - _setupTimeline(); + _setupTimeline(true); }; dynworkflow.selectSubConfig = function(subConfig) { _selectSubConfig(subConfig); }; - + dynworkflow.userSelectedAnOption = function() { _userSelectedAnOption(); }; diff --git a/view/assets/js/jquery.scrollTo.js b/view/assets/js/jquery.scrollTo.js new file mode 100644 index 0000000..7ba1776 --- /dev/null +++ b/view/assets/js/jquery.scrollTo.js @@ -0,0 +1,210 @@ +/*! + * jQuery.scrollTo + * Copyright (c) 2007-2015 Ariel Flesler - afleslergmailcom | http://flesler.blogspot.com + * Licensed under MIT + * http://flesler.blogspot.com/2007/10/jqueryscrollto.html + * @projectDescription Lightweight, cross-browser and highly customizable animated scrolling with jQuery + * @author Ariel Flesler + * @version 2.1.2 + */ +;(function(factory) { + 'use strict'; + if (typeof define === 'function' && define.amd) { + // AMD + define(['jquery'], factory); + } else if (typeof module !== 'undefined' && module.exports) { + // CommonJS + module.exports = factory(require('jquery')); + } else { + // Global + factory(jQuery); + } +})(function($) { + 'use strict'; + + var $scrollTo = $.scrollTo = function(target, duration, settings) { + return $(window).scrollTo(target, duration, settings); + }; + + $scrollTo.defaults = { + axis:'xy', + duration: 0, + limit:true + }; + + function isWin(elem) { + return !elem.nodeName || + $.inArray(elem.nodeName.toLowerCase(), ['iframe','#document','html','body']) !== -1; + } + + $.fn.scrollTo = function(target, duration, settings) { + if (typeof duration === 'object') { + settings = duration; + duration = 0; + } + if (typeof settings === 'function') { + settings = { onAfter:settings }; + } + if (target === 'max') { + target = 9e9; + } + + settings = $.extend({}, $scrollTo.defaults, settings); + // Speed is still recognized for backwards compatibility + duration = duration || settings.duration; + // Make sure the settings are given right + var queue = settings.queue && settings.axis.length > 1; + if (queue) { + // Let's keep the overall duration + duration /= 2; + } + settings.offset = both(settings.offset); + settings.over = both(settings.over); + + return this.each(function() { + // Null target yields nothing, just like jQuery does + if (target === null) return; + + var win = isWin(this), + elem = win ? this.contentWindow || window : this, + $elem = $(elem), + targ = target, + attr = {}, + toff; + + switch (typeof targ) { + // A number will pass the regex + case 'number': + case 'string': + if (/^([+-]=?)?\d+(\.\d+)?(px|%)?$/.test(targ)) { + targ = both(targ); + // We are done + break; + } + // Relative/Absolute selector + targ = win ? $(targ) : $(targ, elem); + /* falls through */ + case 'object': + if (targ.length === 0) return; + // DOMElement / jQuery + if (targ.is || targ.style) { + // Get the real position of the target + toff = (targ = $(targ)).offset(); + } + } + + var offset = $.isFunction(settings.offset) && settings.offset(elem, targ) || settings.offset; + + $.each(settings.axis.split(''), function(i, axis) { + var Pos = axis === 'x' ? 'Left' : 'Top', + pos = Pos.toLowerCase(), + key = 'scroll' + Pos, + prev = $elem[key](), + max = $scrollTo.max(elem, axis); + + if (toff) {// jQuery / DOMElement + attr[key] = toff[pos] + (win ? 0 : prev - $elem.offset()[pos]); + + // If it's a dom element, reduce the margin + if (settings.margin) { + attr[key] -= parseInt(targ.css('margin'+Pos), 10) || 0; + attr[key] -= parseInt(targ.css('border'+Pos+'Width'), 10) || 0; + } + + attr[key] += offset[pos] || 0; + + if (settings.over[pos]) { + // Scroll to a fraction of its width/height + attr[key] += targ[axis === 'x'?'width':'height']() * settings.over[pos]; + } + } else { + var val = targ[pos]; + // Handle percentage values + attr[key] = val.slice && val.slice(-1) === '%' ? + parseFloat(val) / 100 * max + : val; + } + + // Number or 'number' + if (settings.limit && /^\d+$/.test(attr[key])) { + // Check the limits + attr[key] = attr[key] <= 0 ? 0 : Math.min(attr[key], max); + } + + // Don't waste time animating, if there's no need. + if (!i && settings.axis.length > 1) { + if (prev === attr[key]) { + // No animation needed + attr = {}; + } else if (queue) { + // Intermediate animation + animate(settings.onAfterFirst); + // Don't animate this axis again in the next iteration. + attr = {}; + } + } + }); + + animate(settings.onAfter); + + function animate(callback) { + var opts = $.extend({}, settings, { + // The queue setting conflicts with animate() + // Force it to always be true + queue: true, + duration: duration, + complete: callback && function() { + callback.call(elem, targ, settings); + } + }); + $elem.animate(attr, opts); + } + }); + }; + + // Max scrolling position, works on quirks mode + // It only fails (not too badly) on IE, quirks mode. + $scrollTo.max = function(elem, axis) { + var Dim = axis === 'x' ? 'Width' : 'Height', + scroll = 'scroll'+Dim; + + if (!isWin(elem)) + return elem[scroll] - $(elem)[Dim.toLowerCase()](); + + var size = 'client' + Dim, + doc = elem.ownerDocument || elem.document, + html = doc.documentElement, + body = doc.body; + + return Math.max(html[scroll], body[scroll]) - Math.min(html[size], body[size]); + }; + + function both(val) { + return $.isFunction(val) || $.isPlainObject(val) ? val : { top:val, left:val }; + } + + // Add special hooks so that window scroll properties can be animated + $.Tween.propHooks.scrollLeft = + $.Tween.propHooks.scrollTop = { + get: function(t) { + return $(t.elem)[t.prop](); + }, + set: function(t) { + var curr = this.get(t); + // If interrupt is true and user scrolled, stop animating + if (t.options.interrupt && t._last && t._last !== curr) { + return $(t.elem).stop(); + } + var next = Math.round(t.now); + // Don't waste CPU + // Browsers don't render floating point scroll + if (curr !== next) { + $(t.elem)[t.prop](next); + t._last = this.get(t); + } + } + }; + + // AMD requirement + return $scrollTo; +}); diff --git a/view/assets/js/tmpJSONParser.js b/view/assets/js/tmpJSONParser.js index 9af79c3..6af2687 100644 --- a/view/assets/js/tmpJSONParser.js +++ b/view/assets/js/tmpJSONParser.js @@ -24,7 +24,13 @@ } function _parseParameterValue(value) { - return !isNaN(value) ? parseInt(value) : value; + if (typeof value == "string" && value.toLowerCase() == 'true') { + return true; + } else if (typeof value == "string" && value.toLowerCase() == 'false') { + return false; + } else { + return !isNaN(value) ? parseInt(value) : value; + } } function _parseTempFacialParameterJSON(tmpJSON) { diff --git a/view/assets/js/wikilibras.js b/view/assets/js/wikilibras.js index d3259a9..e3cb2a4 100644 --- a/view/assets/js/wikilibras.js +++ b/view/assets/js/wikilibras.js @@ -81,7 +81,7 @@ function _isConfigurationComplete(config) { var baseId = '.subconfiguration-panel[mainConfig=' + config + ']'; var total_config = $(baseId + ' .icon_container[json_name][active=true]').length; - var completed_config = $(baseId + ' .icon_container[complete=true]').length; + var completed_config = $(baseId + ' .icon_container[active=true][complete=true]').length; return completed_config != 0 && total_config == completed_config; } @@ -165,8 +165,9 @@ function _showSelectionPanel(option) { _clearPreviousSelection(); _selectIcon(option, true); - _setupGUIOnSelection(option); - + _setupGUIOnSelection(option, function() { + dynworkflow.finishMainConfigSetup(option); + }); dynworkflow.selectMainConfig(option); } @@ -174,7 +175,9 @@ var config = _getCurrentMainConfiguration(); _deselectIcon(config); if (_isConfigurationComplete(config)) { - _finishConfiguration(config); + _finishConfiguration(config, true); + } else { + _finishConfiguration(config, false); } _addZoomOutToAvatar(config, function() { @@ -189,13 +192,19 @@ (_isConfigurationComplete('right-hand') || _isConfigurationComplete('left-hand')); } - function _finishConfiguration(config) { - _setupCheckIcon(config, true); - _setupCheckIcon('avatar-' + config, true); - $('#' + config + '-edit .check-icon').show(); - + function _finishConfiguration(config, toFinish) { + _setupCheckIcon(config, toFinish); + _setupCheckIcon('avatar-' + config, toFinish); + + if (toFinish) { + $('#' + config + '-edit .check-icon').show(); + } else { + $('#' + config + '-edit .check-icon').hide(); + } if (_canRenderSignVideo()) { $('#ready-button').removeClass('disabled'); + } else { + $('#ready-button').addClass('disabled'); } } @@ -209,11 +218,13 @@ } } - function _setupGUIOnSelection(option) { + function _setupGUIOnSelection(option, finishCallback) { $('#ready-button').fadeOut(300); $('.edit-container').fadeOut(300); _addZoomInToAvatar(option, function() { - $('#selection-panel').fadeIn(300); + $('#selection-panel').fadeIn(300, function() { + finishCallback(); + }); }); } @@ -274,7 +285,7 @@ // Render Screen function _submitParameterJSON(callback) { parsedParameterJSON = tmpJSONParser.parse(tmpParameterJSON); - //console.log(parsedParameterJSON); + console.log(parsedParameterJSON); $.ajax({ type: 'POST', diff --git a/view/conf/selection-workflow-json b/view/conf/selection-workflow-json index 9a3f939..9e628d2 100644 --- a/view/conf/selection-workflow-json +++ b/view/conf/selection-workflow-json @@ -15,10 +15,11 @@ "articulacao" : ["passo-1", "passo-2"], "configuracao" : ["passo-1", "passo-2"], "orientacao" : ["passo-1"], + "plano": ["passo-1"], "raio" : ["passo-1"], "velocidade" : ["passo-1"], - "lado_oposto" : ["passo-1"], - "sentido_inverso" : ["passo-1"] + "sentido_inverso" : ["passo-1"], + "lado_oposto" : ["passo-1"] }, "retilineo" : { "articulacao-retilineo": ["passo-1", "passo-2", "passo-3", "passo-4"], diff --git a/view/facial/timeline.html b/view/facial/timeline.html index 541a163..bea08c9 100644 --- a/view/facial/timeline.html +++ b/view/facial/timeline.html @@ -2,23 +2,22 @@
- -
-
- -
-
- -
-
- +
+
+
+ +
+
+ +
+
+ +
-
diff --git a/view/hand/lado_oposto/passo-1.html b/view/hand/lado_oposto/passo-1.html new file mode 100644 index 0000000..877c8b0 --- /dev/null +++ b/view/hand/lado_oposto/passo-1.html @@ -0,0 +1,23 @@ +
+
+ O movimento começa pelo lado oposto? +
+
+
    +
  • Não
  • +
  • Sim
  • +
+
+
+ diff --git a/view/hand/movimento/passo-1.html b/view/hand/movimento/passo-1.html index 7b94377..14a2100 100644 --- a/view/hand/movimento/passo-1.html +++ b/view/hand/movimento/passo-1.html @@ -4,24 +4,23 @@ Escolha o movimento mais parecido
-
    -
  • Pontual
  • - -
  • Retilíneo
  • +
      +
    • Pontual
    • +
    • Retilíneo
    • +
    • Circular
    • -
      - -
      -
      - -
      - -
      - -
      -
      - -
      - -
      - -
      -
      - +
      +
      +
      + +
      + +
      + +
      +
      + +
      + +
      + +
      +
      + +
      + +
      + +
      +
      + +
      + +
      + +
      + +
      + +
      + +
      + +
      + +
      + +
      + +
      + +
      diff --git a/view/hand/velocidade/passo-1.html b/view/hand/velocidade/passo-1.html new file mode 100644 index 0000000..f82a995 --- /dev/null +++ b/view/hand/velocidade/passo-1.html @@ -0,0 +1,28 @@ +
      +
      + Escolha a velocidade do movimento +
      +
      +
        +
      • Lento
      • +
      • Normal
      • +
      • Rápido
      • +
      +
      +
      + diff --git a/view/img/hand-moviment-direction-icon-check.png b/view/img/hand-moviment-direction-icon-check.png new file mode 100644 index 0000000..381d45e Binary files /dev/null and b/view/img/hand-moviment-direction-icon-check.png differ diff --git a/view/img/hand-moviment-direction-icon-hover.png b/view/img/hand-moviment-direction-icon-hover.png new file mode 100644 index 0000000..d5dcf85 Binary files /dev/null and b/view/img/hand-moviment-direction-icon-hover.png differ diff --git a/view/img/hand-moviment-direction-icon.png b/view/img/hand-moviment-direction-icon.png new file mode 100644 index 0000000..a62cdd3 Binary files /dev/null and b/view/img/hand-moviment-direction-icon.png differ diff --git a/view/img/hand-moviment-plane-icon-check.png b/view/img/hand-moviment-plane-icon-check.png new file mode 100644 index 0000000..0d264dd Binary files /dev/null and b/view/img/hand-moviment-plane-icon-check.png differ diff --git a/view/img/hand-moviment-plane-icon-hover.png b/view/img/hand-moviment-plane-icon-hover.png new file mode 100644 index 0000000..4f32b30 Binary files /dev/null and b/view/img/hand-moviment-plane-icon-hover.png differ diff --git a/view/img/hand-moviment-plane-icon.png b/view/img/hand-moviment-plane-icon.png new file mode 100644 index 0000000..0a4fba0 Binary files /dev/null and b/view/img/hand-moviment-plane-icon.png differ diff --git a/view/img/hand-moviment-radius-icon-check.png b/view/img/hand-moviment-radius-icon-check.png new file mode 100644 index 0000000..2b98f22 Binary files /dev/null and b/view/img/hand-moviment-radius-icon-check.png differ diff --git a/view/img/hand-moviment-radius-icon-hover.png b/view/img/hand-moviment-radius-icon-hover.png new file mode 100644 index 0000000..1ba35c9 Binary files /dev/null and b/view/img/hand-moviment-radius-icon-hover.png differ diff --git a/view/img/hand-moviment-radius-icon.png b/view/img/hand-moviment-radius-icon.png new file mode 100644 index 0000000..8ef7c76 Binary files /dev/null and b/view/img/hand-moviment-radius-icon.png differ diff --git a/view/img/hand-moviment-velocity-icon-check.png b/view/img/hand-moviment-velocity-icon-check.png new file mode 100644 index 0000000..371cf29 Binary files /dev/null and b/view/img/hand-moviment-velocity-icon-check.png differ diff --git a/view/img/hand-moviment-velocity-icon-hover.png b/view/img/hand-moviment-velocity-icon-hover.png new file mode 100644 index 0000000..34ac4c7 Binary files /dev/null and b/view/img/hand-moviment-velocity-icon-hover.png differ diff --git a/view/img/hand-moviment-velocity-icon.png b/view/img/hand-moviment-velocity-icon.png new file mode 100644 index 0000000..dd6ca4c Binary files /dev/null and b/view/img/hand-moviment-velocity-icon.png differ diff --git a/view/img/mov/CALAR.gif b/view/img/mov/CALAR.gif deleted file mode 100644 index 6ee943e..0000000 Binary files a/view/img/mov/CALAR.gif and /dev/null differ diff --git a/view/img/mov/CIRCULAR.webm b/view/img/mov/CIRCULAR.webm new file mode 100644 index 0000000..bccdaf4 Binary files /dev/null and b/view/img/mov/CIRCULAR.webm differ diff --git a/view/template.html b/view/template.html index 9a7dff8..93fd9e0 100755 --- a/view/template.html +++ b/view/template.html @@ -173,12 +173,15 @@
      + + + -- libgit2 0.21.2