Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2540278787 | ||
|
|
5ed1977082 | ||
|
|
a750101765 | ||
|
|
aa08a9b57a | ||
|
|
a8960e26ec |
24
rpg-docs/client/lib/bindProperty.js
Normal file
24
rpg-docs/client/lib/bindProperty.js
Normal file
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* Take in a map like this:
|
||||
* {
|
||||
* "#someId": {
|
||||
* proprty1() { return someReactiveValue()}
|
||||
* }
|
||||
* }
|
||||
* and bind the properties to the DOM on autorun.
|
||||
*
|
||||
* Useful for polymer components where you need to set the order of property updating
|
||||
* or alter properties that don't bind well to their attributes
|
||||
*/
|
||||
Blaze.Template.prototype.binding = function(bindingMap){
|
||||
this.onRendered(function(){
|
||||
_.each(bindingMap, (propertyMap, cssPattern) => {
|
||||
node = this.find(cssPattern);
|
||||
_.each(propertyMap, (func, property) => {
|
||||
this.autorun(() => {
|
||||
node[property] = func && func.call && func.call(this, node);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
};
|
||||
@@ -13,8 +13,6 @@
|
||||
<div class="right flex layout vertical center-justified" style="min-width: 180px;">
|
||||
<div class="layout horizontal">
|
||||
<paper-diff-slider id="hitPointSlider"
|
||||
value={{characterCalculate "attributeValue" _id "hitPoints"}}
|
||||
max={{characterCalculate "attributeBase" _id "hitPoints"}}
|
||||
editable pin
|
||||
disabled={{#unless canEditCharacter _id}}true{{/unless}}>
|
||||
</paper-diff-slider>
|
||||
|
||||
@@ -1,3 +1,26 @@
|
||||
const currentId = () => Template.currentData()._id;
|
||||
|
||||
// Use binding to ensure max is always set before value to prevent value clamping poorly
|
||||
Template.healthCard.binding({
|
||||
"#hitPointSlider": {
|
||||
max: () => Characters.calculate.attributeBase(currentId() , "hitPoints"),
|
||||
value: () => Characters.calculate.attributeValue(currentId() , "hitPoints"),
|
||||
}
|
||||
});
|
||||
|
||||
// Reset the old value between characters so that we don't get red health lost
|
||||
// bar when changing character
|
||||
Template.healthCard.onRendered(function(){
|
||||
let oldId = Template.currentData()._id;
|
||||
this.autorun(() => {
|
||||
const id = Template.currentData()._id;
|
||||
if (oldId !== id){
|
||||
this.find("#hitPointSlider").resetOldValue();
|
||||
oldId = id;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Template.healthCard.helpers({
|
||||
tempHitPoints: function(){
|
||||
return TemporaryHitPoints.find({charId: this._id});
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
{{#if characters.count}}
|
||||
<div class="side-list">
|
||||
{{#each characters}}
|
||||
<a href={{pathFor route="characterSheet" data=this}} tabindex="-1" class="side-list-character">
|
||||
<a href={{pathFor route="characterSheet" data=this}} tabindex="-1" class="side-list-character characterRepresentative">
|
||||
<paper-item class="short">
|
||||
<div class="character-name">
|
||||
{{name}}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<template name="layout">
|
||||
<app-drawer-layout class="layout" responsive-width="905px" fullbleed>
|
||||
<app-drawer>
|
||||
<app-drawer style="z-index: 20;">
|
||||
{{> appDrawer}}
|
||||
</app-drawer>
|
||||
{{> yield}}
|
||||
|
||||
@@ -18,11 +18,10 @@ const closeDrawer = function(instance){
|
||||
}
|
||||
|
||||
Template.appDrawer.events({
|
||||
"click app-drawer a": function(event, instance){
|
||||
"click a": function(event, instance){
|
||||
closeDrawer(instance);
|
||||
},
|
||||
"click .feedback": function(event, instance) {
|
||||
console.log("feedback clicked");
|
||||
pushDialogStack({
|
||||
template: "feedback",
|
||||
element: event.currentTarget,
|
||||
|
||||
@@ -337,3 +337,11 @@ ChangeLogs.insert({
|
||||
"Replaced old user interface bugs with entirely new bugs",
|
||||
],
|
||||
});
|
||||
|
||||
ChangeLogs.insert({
|
||||
version: "1.0.1",
|
||||
changes: [
|
||||
"Fixed drawer being hidden by character sheet cards and headers",
|
||||
"Fixed dragging items to characters in the drawer",
|
||||
],
|
||||
});
|
||||
|
||||
@@ -1,13 +1,3 @@
|
||||
s<!--
|
||||
@license
|
||||
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
|
||||
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
|
||||
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
|
||||
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
|
||||
Code distributed by paper as part of the polymer project is also
|
||||
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
|
||||
-->
|
||||
|
||||
<link rel="import" href="../../components/polymer/polymer.html">
|
||||
<link rel="import" href="../../components/iron-a11y-keys-behavior/iron-a11y-keys-behavior.html">
|
||||
<link rel="import" href="../../components/iron-flex-layout/iron-flex-layout.html">
|
||||
@@ -514,6 +504,11 @@ Custom property | Description | Default
|
||||
this.value = this._clampValue(this.value - this.step);
|
||||
},
|
||||
|
||||
resetOldValue: function(){
|
||||
this.secondaryProgress = this.value;
|
||||
this._setOldValue(this.value);
|
||||
},
|
||||
|
||||
_updateKnob: function(value, min, max, snaps, step) {
|
||||
this.setAttribute('aria-valuemin', min);
|
||||
this.setAttribute('aria-valuemax', max);
|
||||
|
||||
Reference in New Issue
Block a user