summaryrefslogtreecommitdiff
path: root/webcards/scripts/cards/deck.js
diff options
context:
space:
mode:
authorKyle Gunger <corechg@gmail.com>2020-05-17 13:15:41 -0400
committerKyle Gunger <corechg@gmail.com>2020-05-17 13:15:41 -0400
commitb48f0adccb11619680a47cac5fa9c68f638bd489 (patch)
tree9e75612c21ae9944b354afa13e2e94834e020e9c /webcards/scripts/cards/deck.js
parentc9e2eee382df60bc7a058b56c804258848477d67 (diff)
[WebCards] Update from my local repos
Diffstat (limited to 'webcards/scripts/cards/deck.js')
-rw-r--r--webcards/scripts/cards/deck.js27
1 files changed, 15 insertions, 12 deletions
diff --git a/webcards/scripts/cards/deck.js b/webcards/scripts/cards/deck.js
index 544a9ef..620a038 100644
--- a/webcards/scripts/cards/deck.js
+++ b/webcards/scripts/cards/deck.js
@@ -1,6 +1,6 @@
// Deck class represents multiple cards.
// Can be arranged in multiple ways.
-function Deck (options = {}){
+function Deck (options = {mode: "stack", smode: "one", sct: 0, pos: [0, 0]}){
this.cards = [];
// View mode
@@ -11,19 +11,19 @@ function Deck (options = {}){
// left (strip-hl)
// right (strip-hr)
// vertical
- // top (strip-vt)
- // bottom (strip-vb)
- this.mode = options.mode;
+ // up (strip-vu)
+ // down (strip-vd)
+ this.inf = options.mode == "infdraw";
- // Select mode
- // above
- // below
- // around
- // one
- // all
+ // Select mode - controls what other cards are selected when one card is selected
+ // above - selectes cards above the selected one
+ // below - selects cards below the selected one
+ // around - selects cards above and below
+ // one - selects only card chosen
+ // all - selects all cards when card selected
this.smode = options.smode;
- // Select count (-1 = all available)
+ // Select count (negative defaults to 0)
// above - controls number of cards above clicked are selected
// below - controls number of cards below clicked are selected
// around
@@ -31,7 +31,7 @@ function Deck (options = {}){
// array - [first number: number above selected] [second number: number below selected]
// one - no effect
// all - no effect
- this.sct = options.sct;
+ this.sct = options.sct > 0 ? options.sct : 0;
// Position
// array of where the deck is centered
@@ -39,6 +39,9 @@ function Deck (options = {}){
this.y = options.pos[1];
this.e = document.createElement("deck");
+ this.e.style.left = this.x + "px";
+ this.e.style.top = this.y + "px";
+ this.e.setAttribute("mode", options.mode);
}
Deck.prototype = {