Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-26191] Ti.UI.SIZE does not take in to account label shadow

GitHub Issuen/a
TypeBug
PriorityNone
StatusOpen
ResolutionUnresolved
Affected Version/sRelease 7.3.0
Fix Version/sn/a
ComponentsAndroid, iOS
Labelsn/a
ReporterJosh Longton
AssigneeUnknown
Created2018-07-10T17:55:15.000+0000
Updated2020-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

FileDateSize
Screen Shot 2018-07-10 at 5.37.37 PM.png2018-07-10T18:02:52.000+0000419261

Comments

  1. Michael Gangolf 2020-09-25

    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();
       

JSON Source