Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
M
Moecube Store
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
Moecube Store
Commits
6e87d1bd
Commit
6e87d1bd
authored
Dec 11, 2012
by
神楽坂玲奈
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
deckbuilder graphics mode
parent
14edc8fd
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
11 deletions
+16
-11
assets/javascripts/decks.coffee
assets/javascripts/decks.coffee
+8
-5
assets/javascripts/decks.js
assets/javascripts/decks.js
+8
-6
No files found.
assets/javascripts/decks.coffee
View file @
6e87d1bd
...
...
@@ -152,16 +152,19 @@ class Deck extends Spine.Controller
@
el
.
jscroll
({
W
:
"12px"
,
Btn
:
{
btn
:
false
}})
else
main_margin
=
Math
.
floor
((
$
(
'.deck_part'
).
width
()
-
$
(
'.card_usage'
).
width
()
*
Math
.
max
(
Math
.
ceil
(
main_count
/4),10)) /
(
Math
.
max
(
Math
.
ceil
(
main_count
/4),10)-1) /
2
)
deck_width
=
$
(
'.deck_part'
).
width
()
card_width
=
$
(
'.card_usage'
).
width
()
main_margin
=
Math
.
floor
((
deck_width
-
card_width
*
Math
.
max
(
Math
.
ceil
(
main_count
/4),10)) /
(
Math
.
max
(
Math
.
ceil
(
main_count
/4),10)-1) /
2
)
$
(
'.deck_part.main'
).
css
{
'margin-left'
:
-
main_margin
,
'margin-right'
:
-
main_margin
}
$
(
'.deck_part.main .card_usage'
).
css
{
'margin-left'
:
main_margin
,
'margin-right'
:
main_margin
}
side_margin
=
Math
.
floor
((
$
(
'.deck_part'
).
width
()
-
$
(
'.card_usage'
).
width
()
*
Math
.
max
(
side_count
,
10
))
/
(
Math
.
max
(
side_count
,
10
)
-
1
)
/
2
)
$
(
'.deck_part.side'
).
css
{
'margin-left'
:
-
side_margin
,
'
margin
-right'
:
-
side_margin
}
side_margin
=
Math
.
floor
((
deck_width
-
card_width
*
Math
.
max
(
side_count
,
10
))
/
(
Math
.
max
(
side_count
,
10
)
-
1
)
/
2
)
$
(
'.deck_part.side'
).
css
{
'margin-left'
:
-
side_margin
,
'
padding
-right'
:
-
side_margin
}
$
(
'.deck_part.side .card_usage'
).
css
{
'margin-left'
:
side_margin
,
'margin-right'
:
side_margin
}
extra_margin
=
Math
.
floor
((
$
(
'.deck_part'
).
width
()
-
$
(
'.card_usage'
).
width
()
*
Math
.
max
(
extra_count
,
10
))
/
(
Math
.
max
(
extra_count
,
10
)
-
1
)
/
2
)
$
(
'.deck_part.extra'
).
css
{
'margin-left'
:
-
extra_margin
,
'
margin
-right'
:
-
extra_margin
}
extra_margin
=
Math
.
floor
((
deck_width
-
card_width
*
Math
.
max
(
extra_count
,
10
))
/
(
Math
.
max
(
extra_count
,
10
)
-
1
)
/
2
)
$
(
'.deck_part.extra'
).
css
{
'margin-left'
:
-
extra_margin
,
'
padding
-right'
:
-
extra_margin
}
$
(
'.deck_part.extra .card_usage'
).
css
{
'margin-left'
:
extra_margin
,
'margin-right'
:
extra_margin
}
location
:
->
"/decks/?name=
#{
@
deck_name
}
&cards=
#{
@
encode
()
}
"
...
...
assets/javascripts/decks.js
View file @
6e87d1bd
...
...
@@ -245,7 +245,7 @@
};
Deck
.
prototype
.
render
=
function
()
{
var
card_usage
,
ca
tegory
,
category_count
,
extra_count
,
extra_margin
,
i
,
main_count
,
main_margin
,
side_count
,
side_margin
,
_i
,
_len
,
_ref
,
var
card_usage
,
ca
rd_width
,
category
,
category_count
,
deck_width
,
extra_count
,
extra_margin
,
i
,
main_count
,
main_margin
,
side_count
,
side_margin
,
_i
,
_len
,
_ref
,
_this
=
this
;
this
.
main
=
[];
this
.
side
=
[];
...
...
@@ -406,7 +406,9 @@
}
});
}
else
{
main_margin
=
Math
.
floor
((
$
(
'
.deck_part
'
).
width
()
-
$
(
'
.card_usage
'
).
width
()
*
Math
.
max
(
Math
.
ceil
(
main_count
/
4
),
10
))
/
(
Math
.
max
(
Math
.
ceil
(
main_count
/
4
),
10
)
-
1
)
/
2
);
deck_width
=
$
(
'
.deck_part
'
).
width
();
card_width
=
$
(
'
.card_usage
'
).
width
();
main_margin
=
Math
.
floor
((
deck_width
-
card_width
*
Math
.
max
(
Math
.
ceil
(
main_count
/
4
),
10
))
/
(
Math
.
max
(
Math
.
ceil
(
main_count
/
4
),
10
)
-
1
)
/
2
);
$
(
'
.deck_part.main
'
).
css
({
'
margin-left
'
:
-
main_margin
,
'
margin-right
'
:
-
main_margin
...
...
@@ -415,19 +417,19 @@
'
margin-left
'
:
main_margin
,
'
margin-right
'
:
main_margin
});
side_margin
=
Math
.
floor
((
$
(
'
.deck_part
'
).
width
()
-
$
(
'
.card_usage
'
).
width
()
*
Math
.
max
(
side_count
,
10
))
/
(
Math
.
max
(
side_count
,
10
)
-
1
)
/
2
);
side_margin
=
Math
.
floor
((
deck_width
-
card_width
*
Math
.
max
(
side_count
,
10
))
/
(
Math
.
max
(
side_count
,
10
)
-
1
)
/
2
);
$
(
'
.deck_part.side
'
).
css
({
'
margin-left
'
:
-
side_margin
,
'
margin
-right
'
:
-
side_margin
'
padding
-right
'
:
-
side_margin
});
$
(
'
.deck_part.side .card_usage
'
).
css
({
'
margin-left
'
:
side_margin
,
'
margin-right
'
:
side_margin
});
extra_margin
=
Math
.
floor
((
$
(
'
.deck_part
'
).
width
()
-
$
(
'
.card_usage
'
).
width
()
*
Math
.
max
(
extra_count
,
10
))
/
(
Math
.
max
(
extra_count
,
10
)
-
1
)
/
2
);
extra_margin
=
Math
.
floor
((
deck_width
-
card_width
*
Math
.
max
(
extra_count
,
10
))
/
(
Math
.
max
(
extra_count
,
10
)
-
1
)
/
2
);
$
(
'
.deck_part.extra
'
).
css
({
'
margin-left
'
:
-
extra_margin
,
'
margin
-right
'
:
-
extra_margin
'
padding
-right
'
:
-
extra_margin
});
return
$
(
'
.deck_part.extra .card_usage
'
).
css
({
'
margin-left
'
:
extra_margin
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment