Skip to content
Draft
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,13 @@ public class UIModule extends KrollModule implements TiApplication.Configuration
@Kroll.constant
public static final int HIDDEN_BEHAVIOR_INVISIBLE = View.INVISIBLE;

@Kroll.constant
public static final int CLIP_MODE_DEFAULT = 0;
@Kroll.constant
public static final int CLIP_MODE_ENABLED = 1;
@Kroll.constant
public static final int CLIP_MODE_DISABLED = -1;

@Kroll.constant
public static final int USER_INTERFACE_STYLE_LIGHT = Configuration.UI_MODE_NIGHT_NO;
@Kroll.constant
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,7 @@ public class TiC
public static final String PROPERTY_CLASS_NAMES = "classNames";
public static final String PROPERTY_CLEAR_ON_EDIT = "clearOnEdit";
public static final String PROPERTY_CLIP_VIEWS = "clipViews";
public static final String PROPERTY_CLIP_MODE = "clipMode";
public static final String PROPERTY_CODE = "code";
public static final String PROPERTY_COLOR = "color";
public static final String PROPERTY_COLUMNS = "columns";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1141,6 +1141,16 @@ public void processProperties(KrollDict d)
}
}

if (d.containsKey(TiC.PROPERTY_CLIP_MODE) && !nativeViewNull) {
if (nativeView != null
&& TiConvert.toInt(d, TiC.PROPERTY_CLIP_MODE) == -1
&& nativeView instanceof ViewGroup viewGroup
&& viewGroup.getParent() == null) {
viewGroup.setClipChildren(false);
viewGroup.setClipToPadding(false);
}
}

if (!nativeViewNull && d.containsKeyAndNotNull(TiC.PROPERTY_TRANSITION_NAME)) {
ViewCompat.setTransitionName(nativeView, d.getString(TiC.PROPERTY_TRANSITION_NAME));
}
Expand Down
22 changes: 12 additions & 10 deletions apidoc/Titanium/UI/View.yml
Original file line number Diff line number Diff line change
Expand Up @@ -198,9 +198,9 @@ description: |
The shadow of the view is drawn using a rounded rectangle with the arc radius set to the `borderRadius` property.

The `clipMode` property lets the user control the clipping behavior of the View.
Setting this to <Titanium.UI.iOS.CLIP_MODE_ENABLED> enforces all child views to be clipped to this views bounds.
Setting this to <Titanium.UI.iOS.CLIP_MODE_DISABLED> allows child views to be drawn outside the bounds of this view.
When set to <Titanium.UI.iOS.CLIP_MODE_DEFAULT> or when this property is not set, clipping behavior is defined by the following rules applied in order.
Setting this to <Titanium.UI.CLIP_MODE_ENABLED> enforces all child views to be clipped to this views bounds.
Setting this to <Titanium.UI.CLIP_MODE_DISABLED> allows child views to be drawn outside the bounds of this view.
When set to <Titanium.UI.CLIP_MODE_DEFAULT> or when this property is not set, clipping behavior is defined by the following rules applied in order.

* If the `viewShadowColor` is defined to be a color with alpha > 0, clipping is disabled.
* If the `borderWidth` or `borderRadius` of the view is set to a value > 0, clipping is enabled.
Expand Down Expand Up @@ -1431,15 +1431,17 @@ properties:
- name: clipMode
summary: View's clipping behavior.
description: |
Setting this to <Titanium.UI.iOS.CLIP_MODE_ENABLED> enforces all child views to be clipped to this views bounds.
Setting this to <Titanium.UI.iOS.CLIP_MODE_DISABLED> allows child views to be drawn outside the bounds of this view.
When set to <Titanium.UI.iOS.CLIP_MODE_DEFAULT> or when this property is not set, clipping behavior is inferred.
See section on iOS Clipping Behavior in <Titanium.UI.View>.
Setting this to <Titanium.UI.CLIP_MODE_ENABLED> enforces all child views to be clipped to this views bounds.
Setting this to <Titanium.UI.CLIP_MODE_DISABLED> allows child views to be drawn outside the bounds of this view.
When set to <Titanium.UI.CLIP_MODE_DEFAULT> or when this property is not set, clipping behavior is inferred.
See section on Clipping Behavior in <Titanium.UI.View>.

Defaults to `undefined`. Behaves as if set to <Titanium.UI.iOS.CLIP_MODE_DEFAULT>.
Android: This property is "creation only" and has to be on the top-level view.

Defaults to `undefined`. Behaves as if set to <Titanium.UI.CLIP_MODE_DEFAULT>.
type: Number
platforms: [iphone, ipad, macos]
since: "3.3.0"
platforms: [android, iphone, ipad, macos]
since: {android: "12.7.0", iphone: "3.3.0", ipad: "3.3.0"}

- name: elevation
summary: Base elevation of the view relative to its parent in pixels.
Expand Down
9 changes: 9 additions & 0 deletions apidoc/Titanium/UI/iOS/iOS.yml
Original file line number Diff line number Diff line change
Expand Up @@ -340,20 +340,29 @@ properties:
type: Number
permission: read-only
since: "3.3.0"
deprecated:
since: "12.7.0"
notes: Use [Titanium.UI.CLIP_MODE_DEFAULT](Titanium.UI.CLIP_MODE_DEFAULT) instead.

- name: CLIP_MODE_DISABLED
summary: |
Use with <Titanium.UI.View.clipMode> to specify clipping behavior.
type: Number
permission: read-only
since: "3.3.0"
deprecated:
since: "12.7.0"
notes: Use [Titanium.UI.CLIP_MODE_DISABLED](Titanium.UI.CLIP_MODE_DISABLED) instead.

- name: CLIP_MODE_ENABLED
summary: |
Use with <Titanium.UI.View.clipMode> to specify clipping behavior.
type: Number
permission: read-only
since: "3.3.0"
deprecated:
since: "12.7.0"
notes: Use [Titanium.UI.CLIP_MODE_ENABLED](Titanium.UI.CLIP_MODE_ENABLED) instead.

- name: COLLISION_MODE_ALL
summary: |
Expand Down
3 changes: 3 additions & 0 deletions iphone/Classes/TiUIiOSProxy.m
Original file line number Diff line number Diff line change
Expand Up @@ -143,14 +143,17 @@ - (NSNumber *)SCROLL_DECELERATION_RATE_FAST

- (NSNumber *)CLIP_MODE_DEFAULT
{
DEPRECATED_REPLACED(@"UI.iOS.CLIP_MODE_DEFAULT", @"12.7.0", @"UI.CLIP_MODE_DEFAULT");
return NUMINT(0);
}
- (NSNumber *)CLIP_MODE_ENABLED
{
DEPRECATED_REPLACED(@"UI.iOS.CLIP_MODE_ENABLED", @"12.7.0", @"UI.CLIP_MODE_ENABLED");
return NUMINT(1);
}
- (NSNumber *)CLIP_MODE_DISABLED
{
DEPRECATED_REPLACED(@"UI.iOS.CLIP_MODE_DISABLED", @"12.7.0", @"UI.CLIP_MODE_DISABLED");
return NUMINT(-1);
}

Expand Down
4 changes: 4 additions & 0 deletions iphone/Classes/UIModule.h
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,10 @@
@property (nonatomic, readonly) NSString *TEXT_STYLE_CALLOUT;
@property (nonatomic, readonly) NSString *TEXT_STYLE_LARGE_TITLE;

@property (nonatomic, readonly) NSNumber *CLIP_MODE_DEFAULT;
@property (nonatomic, readonly) NSNumber *CLIP_MODE_ENABLED;
@property (nonatomic, readonly) NSNumber *CLIP_MODE_DISABLED;

- (id)createMatrix2D:(id)args;
- (id)create2DMatrix:(id)args; // Deprecated since 8.0.0
- (id)createMatrix3D:(id)args;
Expand Down
12 changes: 12 additions & 0 deletions iphone/Classes/UIModule.m
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,18 @@ - (NSString *)TEXT_STYLE_LARGE_TITLE
{
return UIFontTextStyleLargeTitle;
}
- (NSNumber *)CLIP_MODE_DEFAULT
{
return NUMINT(0);
}
- (NSNumber *)CLIP_MODE_ENABLED
{
return NUMINT(1);
}
- (NSNumber *)CLIP_MODE_DISABLED
{
return NUMINT(-1);
}

- (void)setOverrideUserInterfaceStyle:(id)args
{
Expand Down
Loading