diff --git a/rpg-docs/Model/Character/Characters.js b/rpg-docs/Model/Character/Characters.js index 40de4920..6dbaa10f 100644 --- a/rpg-docs/Model/Character/Characters.js +++ b/rpg-docs/Model/Character/Characters.js @@ -223,8 +223,8 @@ var attributeBase = function(charId, statName){ //start with the highest base value _.each(effects.base, function(effect){ var efv = evaluateEffect(charId, effect) - if (effect.value > value){ - value = effect.value; + if (efv > value){ + value = efv; } }); diff --git a/rpg-docs/bower.json b/rpg-docs/bower.json index a6176151..641115d1 100644 --- a/rpg-docs/bower.json +++ b/rpg-docs/bower.json @@ -13,9 +13,9 @@ "tests" ], "dependencies": { - "polymer": "Polymer/polymer#~0.5.2", - "core-elements": "Polymer/core-elements#~0.5.2", - "paper-elements": "Polymer/paper-elements#~0.5.2", + "polymer": "Polymer/polymer#~0.5.4", + "core-elements": "Polymer/core-elements#~0.5.4", + "paper-elements": "Polymer/paper-elements#~0.5.4", "paper-fab-menu": "cwdoh/paper-fab-menu" }, "resolutions": { diff --git a/rpg-docs/client/globalHelpers/GlobalUI.js b/rpg-docs/client/globalHelpers/GlobalUI.js index cb066932..14f7289c 100644 --- a/rpg-docs/client/globalHelpers/GlobalUI.js +++ b/rpg-docs/client/globalHelpers/GlobalUI.js @@ -9,7 +9,7 @@ this.GlobalUI = (function() { toast.text = text; return toast.show(); }; - + GlobalUI.setDialog = function(opts){ this.dialog = $("[global-dialog]")[0]; Session.set("global.ui.dialogHeader", opts.heading); @@ -30,6 +30,33 @@ this.GlobalUI = (function() { }; })(this)); }; + + //To show a detail, first animate the click, with raising z-depth + //then call this function with a template and data + //the element should have a hero-id of detail-main + GlobalUI.showDetail = function(opts) { + Session.set("global.ui.detailData", opts.data); + Session.set("global.ui.detailTemplate", opts.template); + GlobalUI.detailHero = opts.hero; + Session.set("global.ui.detailShow", true); + }; + + //if setting the detail rather than showing it, + //the template should contain the following in template.rendered + // + //if (!this.alreadyRendered){ + // Session.set("global.ui.detailShow", true); + // this.alreadyRendered = true; + //} + GlobalUI.setDetail = function(opts) { + Session.set("global.ui.detailData", opts.data); + Session.set("global.ui.detailTemplate", opts.template); + GlobalUI.detailHero = opts.hero; + }; + + GlobalUI.closeDetail = function(){ + Session.set("global.ui.detailShow", false); + }; GlobalUI.closeDialog = function() { return this.dialog.close(); @@ -51,6 +78,15 @@ Template.layout.helpers({ }, globalDialogHeader: function(){ return Session.get("global.ui.dialogHeader"); + }, + globalDetailSelected: function(){ + return Session.get("global.ui.detailShow") ? 1 : 0; + }, + globalDetailTemplate: function(){ + return Session.get("global.ui.detailTemplate"); + }, + globalDetailData: function(){ + return Session.get("global.ui.detailData"); } }); @@ -60,4 +96,37 @@ Template.layout.events({ Session.set("global.ui.dialogData", null); return Session.set("global.ui.dialogFullOnMobile", null); }, + "core-animated-pages-transition-end [detail-pages]": function(e) { + var detailOpened = Session.get("global.ui.detailShow"); + if(detailOpened){ + //HACK by putting core-selected back on the main content section + //we stop it being hidden while the detail section is shown + $("#mainContentSection").addClass("core-selected"); + //but we still want to track whether it is or isn't actually selected + //so we can hide hero elements, since they are technically now shown as detail + $("#mainContentSection").addClass("fake-selected"); + } else { + Session.set("global.ui.detailData", null); + Session.set("global.ui.detailTemplate", null); + //remove the hero attribute + var heroElem = GlobalUI.detailHero; + heroElem && heroElem.attr("hero", null); + heroElem && heroElem.find("[hero-id]").attr("hero", null); + GlobalUI.detailHero = null; + } + }, + "core-animated-pages-transition-prepare": function(e) { + var detailOpened = Session.get("global.ui.detailShow"); + if(detailOpened) { + //add the hero attribute where needed + var heroElem = GlobalUI.detailHero; + heroElem && heroElem.attr("hero", ""); + heroElem && heroElem.find("[hero-id]").attr("hero", ""); + } else { + $("#mainContentSection").removeClass("fake-selected"); + } + }, + "tap #screenDim": function(e){ + GlobalUI.closeDetail(); + } }); diff --git a/rpg-docs/client/views/GeneralCSS/globalDetail.css b/rpg-docs/client/views/GeneralCSS/globalDetail.css new file mode 100644 index 00000000..1cb9b4fe --- /dev/null +++ b/rpg-docs/client/views/GeneralCSS/globalDetail.css @@ -0,0 +1,33 @@ +#detailScreenFiller { + position: fixed; + top: 0; + bottom: 0; + left: 0; + right: 0; + z-index: 2; + + display: flex; + justify-content: center; + align-items: center; +} + +#screenDim { + position: absolute; + top: 0; + bottom: 0; + left: 0; + right: 0; + background-color: black; + opacity: 0.0; +} + + +#globalDetail { + background-color: white; + width: 624px; + height: 500px; +} + +.fake-selected [hero] { + visibility: hidden; +} diff --git a/rpg-docs/client/views/character/characterSheet.js b/rpg-docs/client/views/character/characterSheet.js index 7966ce43..dc950eaf 100644 --- a/rpg-docs/client/views/character/characterSheet.js +++ b/rpg-docs/client/views/character/characterSheet.js @@ -43,6 +43,9 @@ Template.characterSheet.events({ "swiperight": function(event){ incTab(Template.instance(), -1); }, + "core-animated-pages-transition-end #tabPages": function(event) { + event.stopPropagation(); + } }); /* requires the following templates diff --git a/rpg-docs/client/views/character/effectEdit/effectEdit.css b/rpg-docs/client/views/character/effectEdit/effectEdit.css index 58cef736..4d67f399 100644 --- a/rpg-docs/client/views/character/effectEdit/effectEdit.css +++ b/rpg-docs/client/views/character/effectEdit/effectEdit.css @@ -22,7 +22,7 @@ html /deep/ paper-input { margin-bottom: 1px; } -html /deep/ .featureEffect { +html /deep/ .effectEdit { display: flex; align-items: flex-end; } diff --git a/rpg-docs/client/views/character/effectEdit/effectEdit.html b/rpg-docs/client/views/character/effectEdit/effectEdit.html index a1cc9e03..f5856258 100644 --- a/rpg-docs/client/views/character/effectEdit/effectEdit.html +++ b/rpg-docs/client/views/character/effectEdit/effectEdit.html @@ -1,20 +1,20 @@