Skip to content

Commit

Permalink
Fixing issues caused by the previous fix...
Browse files Browse the repository at this point in the history
  • Loading branch information
istvan-ujjmeszaros committed Feb 13, 2014
1 parent 5023ba0 commit bdedab8
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 20 deletions.
2 changes: 1 addition & 1 deletion css-gradient-generator.jquery.json
Expand Up @@ -9,7 +9,7 @@
"responsive",
"widget"
],
"version": "2.0.1",
"version": "2.0.2",
"author": {
"name": "Virtuosoft",
"url": "https://github.com/Virtuosoft"
Expand Down
56 changes: 37 additions & 19 deletions resources/gradienteditor.js
Expand Up @@ -4,7 +4,7 @@

/*!=========================================================================
* CSS Background Generator
* v2.0.1
* v2.0.2
*
* http://www.virtuosoft.eu/tools/css-gradient-generator/
*
Expand Down Expand Up @@ -354,12 +354,6 @@ var CSSGradientEditor = function(container, options) {

layout = getConfig("config_layout");

if (layoutneededforgradient + "_" + layout === lastlayoutstate) {
return;
}

lastlayoutstate = layoutneededforgradient + "_" + layout;

elements.layoutselectoreasy.removeClass("active");
elements.layoutselectoradvanced.removeClass("active");
elements.layoutselectorexpert.removeClass("active");
Expand All @@ -379,39 +373,61 @@ var CSSGradientEditor = function(container, options) {
}
}

elements.warningadvanced.hide();
elements.warningexpert.hide();

checkiflayoutcanchange = false;

if (layoutneededforgradient > layout) {
checkiflayoutcanchange = true;
if (layoutneededforgradient === LAYOUT_ADVANCED) {
elements.warningadvanced.show();
if (!elements.warningadvanced.is(":visible")) {
elements.warningadvanced.show();
}
}
else {
elements.warningexpert.show();
if (!elements.warningexpert.is(":visible")) {
elements.warningexpert.show();
}
}

layout = layoutneededforgradient;
}
else {
if (elements.warningadvanced.is(":visible")) {
elements.warningadvanced.hide();
}
if (elements.warningexpert.is(":visible")) {
elements.warningexpert.hide();
}
}

var nowchanged = false;

switch(layout) {
case LAYOUT_SIMPLE:
container.removeClass("layout-advanced layout-expert");
container.addClass("layout-simple");
if (!container.hasClass("layout-simple")) {
nowchanged = true;
container.removeClass("layout-advanced layout-expert");
container.addClass("layout-simple");
}
break;
case LAYOUT_ADVANCED:
container.removeClass("layout-simple layout-expert");
container.addClass("layout-advanced");
if (!container.hasClass("layout-advanced")) {
nowchanged = true;
container.removeClass("layout-simple layout-expert");
container.addClass("layout-advanced");
}
break;
case LAYOUT_EXPERT:
container.removeClass("layout-simple layout-advanced");
container.addClass("layout-expert");
if (!container.hasClass("layout-expert")) {
nowchanged = true;
container.removeClass("layout-simple layout-advanced");
container.addClass("layout-expert");
}
break;
}

renderAll();
if (nowchanged) {
renderAll();
}
}

function updateInputValues() {
Expand Down Expand Up @@ -4129,6 +4145,8 @@ var CSSGradientEditor = function(container, options) {
return;
}

lastlayoutstate = false;

if (getPreference("gradient_type") === "linear") {
if (getPreference("gradient_direction") === "angle") {
setPreference("gradient_direction", simplifyDirection());
Expand Down

0 comments on commit bdedab8

Please sign in to comment.