Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature/card alignment #104

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions generator/data/card_data_example.js
Original file line number Diff line number Diff line change
@@ -115,7 +115,7 @@ var card_data_example = [
"bullet | magic missile, 2nd level (2 charges)",
"bullet | magic missile, 3rd level (3 charges)",
"fill | 3",
"boxes | 7 | 2.5"
"boxes | 7 | 2.5 | center"
],
"tags": ["item", "wondrous-item", "magic"]
},
@@ -160,4 +160,4 @@ var card_data_example = [
],
"tags": ["creature", "humanoid"]
}
]
]
3 changes: 2 additions & 1 deletion generator/js/cards.js
Original file line number Diff line number Diff line change
@@ -141,10 +141,11 @@ function card_element_boxes(params, card_data, options) {
var stroke = ' stroke="' + color + '"';
var count = params[0] || 1;
var size = params[1] || 3;
var elementStyle = params[2] ? 'style="text-align: ' + params[2] + ';"' : "";
var style = 'style="width:' + size + 'em;height:' + size + 'em"';

var result = "";
result += '<div class="card-element card-description-line">';
result += '<div class="card-element card-description-line" ' + elementStyle + '>';
for (var i = 0; i < count; ++i) {
result += '<svg class="card-box" height="100" width="100" viewbox="0 0 100 100" preserveaspectratio="none" xmlns="http://www.w3.org/2000/svg" ' + style + '>';
result += ' <rect x="5" y="5" width="90" height="90" ' + fill + stroke + ' style="stroke-width:10">';