-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GridView: Fit image to grid item without crop (#1692)
GridView: Fit image icons to grid item size with margin - (util) Image: Check image transparency - implement icon detection - add image-icon styles for TV resolution Signed-off-by: Tomasz Lukawski <[email protected]>
- Loading branch information
1 parent
4488799
commit 633273f
Showing
7 changed files
with
213 additions
and
1 deletion.
There are no files selected for viewing
70 changes: 70 additions & 0 deletions
70
examples/mobile/UIComponents/components/thumbnail/grid-text-icons-mixed.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
|
||
<head> | ||
<title>Grid</title> | ||
<meta content="width=device-width, user-scalable=no" name="viewport" /> | ||
<link href="../../lib/tau/mobile/theme/changeable/tau.css" rel="stylesheet" /> | ||
<link href="../../css/style.css" rel="stylesheet" /> | ||
<script data-build-remove="false" src="../../lib/tau/mobile/js/tau.js"> | ||
</script> | ||
</head> | ||
|
||
<body> | ||
<div class="ui-page" id="page-thumbnail-grid"> | ||
<div class="ui-header" data-position="fixed"> | ||
<div class="ui-appbar-left-icons-container"> | ||
<a href="#" class="ui-btn ui-btn-icon ui-btn-icon-back" data-style="flat" data-rel="back"></a> | ||
</div> | ||
<h1> | ||
Thumbnail Icon Grid + text | ||
</h1> | ||
</div> | ||
<div class="ui-content"> | ||
<ul class="ui-gridview ui-gridview-cols"> | ||
<li class="ui-gridview-item"> | ||
<img class="ui-gridview-image" src="./../../icon.png" /> | ||
<p class="ui-gridview-label">Recipe title</p> | ||
</li> | ||
<li class="ui-gridview-item"> | ||
<img class="ui-gridview-image" src="../../images/Thumbnail/thumbnail_002.jpg" /> | ||
<p class="ui-gridview-label">Recipe title</p> | ||
</li> | ||
<li class="ui-gridview-item"> | ||
<img class="ui-gridview-image" src="./../../icon-tizen.png" /> | ||
<p class="ui-gridview-label">Recipe title</p> | ||
</li> | ||
<li class="ui-gridview-item"> | ||
<img class="ui-gridview-image" src="../../images/Thumbnail/thumbnail_004.jpg" /> | ||
<p class="ui-gridview-label">Recipe title</p> | ||
</li> | ||
<li class="ui-gridview-item"> | ||
<img class="ui-gridview-image" src="./../../icon.png" /> | ||
<p class="ui-gridview-label">Recipe title</p> | ||
</li> | ||
<li class="ui-gridview-item"> | ||
<img class="ui-gridview-image" src="../../images/Thumbnail/thumbnail_006.jpg" /> | ||
<p class="ui-gridview-label">Recipe title</p> | ||
</li> | ||
<li class="ui-gridview-item"> | ||
<img class="ui-gridview-image" src="./../../icon.png" /> | ||
<p class="ui-gridview-label">Recipe title</p> | ||
</li> | ||
<li class="ui-gridview-item"> | ||
<img class="ui-gridview-image" src="./../../icon.png" /> | ||
<p class="ui-gridview-label">Recipe title</p> | ||
</li> | ||
<li class="ui-gridview-item"> | ||
<img class="ui-gridview-image" src="../../images/Thumbnail/thumbnail_009.jpg" /> | ||
<p class="ui-gridview-label">Recipe title</p> | ||
</li> | ||
<li class="ui-gridview-item"> | ||
<img class="ui-gridview-image" src="./../../icon.png" /> | ||
<p class="ui-gridview-label">Recipe title</p> | ||
</li> | ||
</ul> | ||
</div> | ||
</div> | ||
</body> | ||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
/* | ||
* Copyright (c) 2021 Samsung Electronics Co., Ltd | ||
* | ||
* Licensed under the Flora License, Version 1.1 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://floralicense.org/license/ | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
/*global define, ns */ | ||
/** | ||
* #Image Utility | ||
* Object supports methods for images | ||
* @author Tomasz Lukawski <[email protected]> | ||
* @class ns.util.image | ||
*/ | ||
(function (ns) { | ||
"use strict"; | ||
//>>excludeStart("tauBuildExclude", pragmas.tauBuildExclude); | ||
define( | ||
[ | ||
// fetch namespace | ||
"../util" | ||
], | ||
function () { | ||
//>>excludeEnd("tauBuildExclude"); | ||
var image = { | ||
/** | ||
* @method checkTransparency | ||
* @param {HTMLElement} image | ||
* @param {Array} points | ||
* @return {boolean} | ||
* @static | ||
* @member ns.util.image | ||
*/ | ||
checkTransparency: function (image, points) { | ||
var c, | ||
cnx, | ||
imageData; | ||
|
||
c = document.createElement("canvas"); | ||
cnx = c.getContext("2d"); | ||
c.width = image.width; | ||
c.height = image.height; | ||
|
||
points = points || [ | ||
[0, 0], [image.width - 1, 0], [image.width - 1, image.height - 1], [0, image.height - 1] | ||
]; | ||
|
||
cnx.drawImage(image, 0, 0, image.width, image.height); | ||
|
||
return points.some(function (point) { | ||
imageData = cnx.getImageData(point[0], point[1], 1, 1); | ||
return imageData && imageData.data[3] !== 255 || false; | ||
}); | ||
} | ||
}; | ||
|
||
ns.util.image = image; | ||
//>>excludeStart("tauBuildExclude", pragmas.tauBuildExclude); | ||
return image; | ||
} | ||
); | ||
//>>excludeEnd("tauBuildExclude"); | ||
}(ns)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters