Browse Source

Allow adding extra metadata to dice

universalis
parent
commit
d3f7aabbea
1 changed files with 5 additions and 1 deletions
  1. +5
    -1
      dice/dice.js

+ 5
- 1
dice/dice.js View File

@@ -250,9 +250,10 @@
return dieInfo[type].labels + dieColor + labelColor;
}

function createDie(type, labelColor, dieColor) {
function createDie(type, labelColor, dieColor, extraUserData) {
labelColor = labelColor || defaultLabelColor;
dieColor = dieColor || defaultDieColor;
extraUserData = extraUserData || {};

if (!dieGeometryCache[type]) {
dieGeometryCache[type] = createDieGeometry(
@@ -273,6 +274,9 @@
die.userData = {type: type,
labelColor: labelColor,
dieColor: dieColor};
for (var p in extraUserData) {
die.userData[p] = extraUserData[p];
}
return die;
}



Loading…
Cancel
Save