[TIMOB-26191] Ti.UI.SIZE does not take in to account label shadow
| GitHub Issue | n/a |
| Type | Bug |
| Priority | None |
| Status | Open |
| Resolution | Unresolved |
| Affected Version/s | Release 7.3.0 |
| Fix Version/s | n/a |
| Components | Android, iOS |
| Labels | n/a |
| Reporter | Josh Longton |
| Assignee | Unknown |
| Created | 2018-07-10T17:55:15.000+0000 |
| Updated | 2020-09-25T21:47:08.000+0000 |
Description
Ti.UI.SIZE does not take in to account the shadow offset and cuts it off
*Test case*
{noformat}
var win = Ti.UI.createWindow({
backgroundColor: 'white',
exitOnClose: true,
fullscreen: false,
layout: 'vertical',
title: 'Label Demo'
});
var label1 = Ti.UI.createLabel({
color: '#900',
font: { fontSize:48 },
shadowColor: '#aaa',
shadowOffset: {x:50, y:50},
shadowRadius: 3,
text: 'A simple label',
textAlign: Ti.UI.TEXT_ALIGNMENT_CENTER,
top: 30,
width: Ti.UI.SIZE, height: Ti.UI.SIZE
});
var label2 = Ti.UI.createLabel({
color:'blue',
text: 'A long label with\na few line breaks\nand unicode (UTF8)\nsymbols such as\na white chess piece \u2655\nand the euro symbol \u20ac\nlooks like this!\n',
textAlign: Ti.UI.TEXT_ALIGNMENT_LEFT,
top: 30,
width: 300, height: 200
});
win.add(label1);
win.add(label2);
win.open();
{noformat}
*Expected*
The shadow should not be cut short
*Actual*
!Screen Shot 2018-07-10 at 5.37.37 PM.png|thumbnail!
Attachments
For Android you can use this hyperloop code:
import View from 'android.view.View'; import ViewGroup from 'android.view.ViewGroup'; var win = Ti.UI.createWindow({ backgroundColor: 'white', exitOnClose: true, fullscreen: false, layout: 'vertical', title: 'Label Demo' }); var label1 = Ti.UI.createLabel({ color: '#900', font: { fontSize: 48 }, shadowColor: '#aaa', shadowOffset: { x: 50, y: 50 }, shadowRadius: 3, text: 'A simple label', textAlign: Ti.UI.TEXT_ALIGNMENT_CENTER, top: 30, width: Ti.UI.SIZE, height: Ti.UI.SIZE }); win.addEventListener("open", function() { // unclip the view ViewGroup.cast(new View(label1).getParent()).setClipChildren(false); }) win.add(label1); win.open();