Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-17149] TiAPI : Support percentages for borderRadius

GitHub Issuen/a
TypeNew Feature
PriorityLow
StatusOpen
ResolutionUnresolved
Affected Version/sRelease 3.2.3
Fix Version/sn/a
ComponentsTiAPI
LabelsTi.UI.View, borderRadius
ReporterFokke Zandbergen
AssigneeUnknown
Created2014-06-12T09:38:50.000+0000
Updated2018-02-28T20:03:44.000+0000

Description

I have a Ti.UI.View which requires its width to be set to a percentage. Now I want the borderRadius of this view to be 50% of it's width so the view shows as a circle. But borderRadius does not support percentages. I'm not sure if the borderRadius on each 2 sides of a corner could differ, but if it can't I understand this would make it difficult to support percentages. But even in that case you could first look if either width or height is not set or set to Ti.UI.SIZE and then use the other and if both are (not) set default to the width e.g. An example that uses a transparent square image to try to make a circle that should be 50% of the width of the window:
var win = Ti.UI.createWindow();

var circle = Ti.UI.createView({
  width: '30%',
  backgroundColor: 'red',
  borderRadius: '50%',

  // so that the height will be that of the square
  height: Ti.UI.SIZE
});

var square = Ti.UI.createImageView({
  width: Ti.UI.FILL,
  image: '/images/transparent_square.png',

  // so that the height will equal the absolute width
  height: Ti.UI.SIZE
});

circle.add(square);
win.add(circle);

win.open();

Comments

  1. Ritu Agrawal 2014-06-12

    Moving this feature request to Engineering for further evaluation and prioritization.

JSON Source