Skip to content

Commit 77ce7ac

Browse files
authored
Merge pull request #57 from vish250491/master
Set background color to selected custom theme color if custom option selected and refactored cropping logic for background image
2 parents 44e2c43 + 0827ec7 commit 77ce7ac

File tree

1 file changed

+9
-14
lines changed

1 file changed

+9
-14
lines changed

widget/index.html

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,11 @@
2323

2424
</head>
2525
<body ng-cloak class="gridLayout" ng-controller="folderPluginCtrl" data-back-img="{{backgroundImage}}">
26-
<style ng-if="data.design.colorType === 'C'">
26+
<style ng-if="data.design.colorType === 'C'">
27+
body.gridLayout {
28+
background-color: {{data.design.colors.backgroundColor}} !important;
29+
}
30+
2731
/* Show theme css only if on custom theme option */
2832
div.text-holder p, .launcher-plugin.layout7 .menu-links .menu-item p {
2933
color: {{data.design.colors.bodyText}} !important;
@@ -477,7 +481,7 @@
477481
dataLoadedHandler(result);
478482
});
479483

480-
$scope.cropImage = function (url, settings) {
484+
/*$scope.cropImage = function (url, settings) {
481485
var options = {};
482486
if (!url) {
483487
return "";
@@ -491,7 +495,7 @@
491495
}
492496
return buildfire.imageLib.cropImage(url, options);
493497
}
494-
};
498+
};*/
495499

496500
$scope.resizeImage = function (url, settings) {
497501
var options = {};
@@ -535,12 +539,11 @@
535539

536540
function setBackgroundImage() {
537541
var backgroundImages = $scope.data.design.backgroundImage;
538-
var backgroundImage = undefined;
539542

540543
if (!backgroundImages) return;
541544

542545
if (typeof($scope.data.design.backgroundImage) === "string") {
543-
backgroundImage = $scope.cropImage($scope.data.design.backgroundImage, {width: deviceWidth, height: deviceHeight});
546+
$scope.backgroundImage = $scope.data.design.backgroundImage;
544547
}
545548
else {
546549
if (!matchedBackgroundName) {
@@ -551,16 +554,8 @@
551554
}
552555
}
553556
console.log('matchedBackgroundName: ', matchedBackgroundName);
554-
555-
if(matchedBackgroundName){
556-
backgroundImage = $scope.cropImage(backgroundImages[matchedBackgroundName], {
557-
width: deviceWidth,
558-
height: deviceHeight
559-
});
560-
}
557+
$scope.backgroundImage = backgroundImages[matchedBackgroundName];
561558
}
562-
563-
$scope.backgroundImage = backgroundImage;
564559
}
565560

566561
function getByMediaQuery(){

0 commit comments

Comments
 (0)