Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-20457] iOS: gradient percentage units are not accurate

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionInvalid
Resolution Date2016-08-09T16:06:55.000+0000
Affected Version/sRelease 5.2.0, Release 5.1.2
Fix Version/sn/a
ComponentsiOS
Labelsalloy, gradient
Reporter Ricardo Ramirez
AssigneeAngel Petkov
Created2016-02-24T18:31:15.000+0000
Updated2017-03-24T17:41:58.000+0000

Description

Issue Description

Gradient angles calculated incorrectly when start/endpoint specified as %

Steps to replicate

Create a new alloy default application

open views/index.xml

replace the code with the next:

<Alloy>
	<Window class="container">
		<View class="someclass" width="100%" height="100%" borderColor="green" borderWidth="1">
			<Label id="label" onClick="doClick">Hello, World</Label>
		</View>
	</Window>
</Alloy>

open styles/index.tss

replace the code with the next:

".someclass": { 
	backgroundGradient: { 
		type: "linear", 
		backfillStart: true, 
		backfillEnd: true, 
		startPoint: { x:'100%', y: '0%' }, 
		endPoint: { x: '0%', y:'100%'}, 
		colors: [{ 
			color: "black", 
			offset: 0.0	
		}, 
		{ 
			color: "black", 
			offset: 0.48	
		}, 
		{ 
			color: "white", 
			offset: 0.52 
		}, 
		{ 
			color: "white", 
			offset: 1 
		}] 
	} 
}

Run

The gradient is not from the left corner to the right corner (image attached)

Expected result

The gradient should be from the left corner to the right corner

Attachments

FileDateSize
Simulator Screen Shot 24.02.2016 12.29.13 p.m..png2016-02-24T18:30:31.000+000036815

Comments

  1. Angel Petkov 2016-02-29

    [~rramirez] This isn't actually a bug , you are correct to assume that it should start from the left corner(i thought the same), however if you take a look [here](https://developer.apple.com/library/ios/documentation/General/Conceptual/Devpedia-CocoaApp/CoordinateSystem.html) on iOS the x and y axis start from the top left corner as oppose to the bottom left corner like they do on mac OS.
  2. Lee Morris 2017-03-24

    Closing ticket as invalid with reference to the above comments.

JSON Source