1
0
mirror of https://github.com/exane/not-gwent-online synced 2024-11-23 19:36:53 +00:00

card margin calculation fixed

This commit is contained in:
exane 2015-07-04 11:22:16 +02:00
parent ec19b0448b
commit ff1033ddb2
2 changed files with 17 additions and 15 deletions

View File

@ -181,7 +181,7 @@ let SideView = Backbone.View.extend({
} }
//calculateCardMargin($field.find(".card"), 351, 70, cards.length); //calculateCardMargin($field.find(".card"), 351, 70, cards.length);
this.battleView.calculateMargin($field.find(".field-close")); this.battleView.calculateMargin($field.find(".field-close"), 5);
}, },
renderRangeField: function(){ renderRangeField: function(){
if(!this.field.ranged) return; if(!this.field.ranged) return;
@ -210,7 +210,7 @@ let SideView = Backbone.View.extend({
} }
//calculateCardMargin($field.find(".card"), 351, 70, cards.length); //calculateCardMargin($field.find(".card"), 351, 70, cards.length);
this.battleView.calculateMargin($field.find(".field-range")); this.battleView.calculateMargin($field.find(".field-range"), 5);
}, },
renderSiegeField: function(){ renderSiegeField: function(){
if(!this.field.siege) return; if(!this.field.siege) return;
@ -239,7 +239,7 @@ let SideView = Backbone.View.extend({
} }
//calculateCardMargin($field.find(".card"), 351, 70, cards.length); //calculateCardMargin($field.find(".card"), 351, 70, cards.length);
this.battleView.calculateMargin($field.find(".field-siege")); this.battleView.calculateMargin($field.find(".field-siege"), 5);
}, },
renderWeatherField: function(){ renderWeatherField: function(){
if(!this.field.weather) return; if(!this.field.weather) return;
@ -587,15 +587,15 @@ let BattleView = Backbone.View.extend({
minSize = typeof minSize === "number" && minSize >= 0 ? minSize : 6; minSize = typeof minSize === "number" && minSize >= 0 ? minSize : 6;
var Class = $container.find(".card-wrap").length ? ".card-wrap" : ".card"; var Class = $container.find(".card-wrap").length ? ".card-wrap" : ".card";
var n = $container.children().size(); var n = $container.children().size();
let w = $container.width(), c = $container.find(Class).outerWidth(); let w = $container.width(), c = $container.find(Class).outerWidth(true);
let res; let res;
if(n < minSize) if(n < minSize)
res = 0; res = 0;
else { else {
res = 0;//-((w - c) / (n - 1) - c) + 1 res = -((w - c) / (n - 1) - c) + 1;
} }
$container.find(Class).css("margin-left", -res); $container.find(Class).not(Class+":first-child").css("margin-left", -res);
} }
}); });

View File

@ -21,7 +21,7 @@
.card { .card {
border: none !important; border: none !important;
margin: 0 !important; margin: 0;
border-radius: 0 !important; border-radius: 0 !important;
overflow: visible !important; overflow: visible !important;
height: 93px !important; height: 93px !important;
@ -32,7 +32,9 @@
height: 93px; height: 93px;
width: 69px; width: 69px;
position: relative; position: relative;
transition: margin .05s ease-in-out 0s;
//causes weird bug when margin gets calculated
//transition: margin .05s ease-in-out 0s;
} }
.card i { .card i {
@ -79,11 +81,11 @@
height: auto !important; height: auto !important;
width: auto !important; width: auto !important;
margin: 3px; margin: 3px;
} }
&.activeCard { .activeCard {
position: relative; position: relative;
z-index: 19 !important;
transform: scale(1.1, 1.1) !important; transform: scale(1.1, 1.1) !important;
} }
@ -99,7 +101,7 @@
z-index: 20; z-index: 20;
} }
.card { /*.card {
float: left; float: left;
height: 93px; height: 93px;
width: 69px; width: 69px;
@ -114,7 +116,7 @@
left: 3px; left: 3px;
height: 87px; height: 87px;
z-index: 10; z-index: 10;
} }*/
/** SHAME **/ /** SHAME **/