Skip to content

Commit ab30fd9

Browse files
committed
Merge remote-tracking branch 'origin/master'
# Conflicts: # yarn.lock
2 parents cb1ca12 + fdcd541 commit ab30fd9

File tree

13 files changed

+82
-97
lines changed

13 files changed

+82
-97
lines changed

demo-snippets/vue/CanvasLabel.vue

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,26 @@
11
<template>
22
<Page>
33
<StackLayout>
4-
<canvaslabel backgroundColor="red" rippleColor="green" borderRadius="10" paddingTop="0" height="80" widht="80">
5-
<CGroup verticalAlignment="middle" textAlignment="center">
6-
<cspan :fontFamily="mdiFontFamily" text="mdi-cellphone-screenshot" fontSize="30" />
7-
<cspan :text="'\n' + 'share screenshot'" fontSize="12" />
8-
</CGroup>
9-
</canvaslabel>
10-
<canvaslabel backgroundColor="yellow" rippleColor="green" borderRadius="10" paddingTop="0" height="80" width="80" lineBreak="middle">
11-
<CGroup>
12-
<cspan text="this is a tesxt to test lineBreak" fontSize="12" />
13-
<cspan :text="'\n' + 'another piece of text which is going to be ellipsized'" fontSize="16" />
14-
</CGroup>
15-
</canvaslabel>
16-
<label backgroundColor="green" rippleColor="green" borderRadius="10" paddingTop="0" height="80" width="80" lineBreak="end" >
4+
<!-- <canvaslabel backgroundColor="red" rippleColor="green" borderRadius="10" paddingTop="0" height="80" widht="80" color="black">
5+
<CGroup verticalAlignment="middle" textAlignment="center">
6+
<cspan :fontFamily="mdiFontFamily" text="mdi-cellphone-screenshot" fontSize="30" />
7+
<cspan :text="'\n' + 'share screenshot'" fontSize="12" />
8+
</CGroup>
9+
</canvaslabel> -->
10+
<canvaslabel backgroundColor="yellow" rippleColor="green" borderRadius="10" paddingTop="0" height="80" width="80" lineBreak="end" color="red">
11+
<CGroup>
12+
<cspan :text="'this is a tesxt to test lineBreak' +'\n' +'test'" fontSize="12" color="blue"/>
13+
<cspan :text="'\n' + 'another piece of text which is going to be ellipsized'" fontSize="16" />
14+
</CGroup>
15+
</canvaslabel>
16+
<label backgroundColor="green" rippleColor="green" borderRadius="10" paddingTop="0" height="80" width="80" lineBreak="end" color="black">
1717
<span text="this is a tesxt to test lineBreak" fontSize="12" />
1818
<span :text="'\n' + 'another piece of text which is going to be ellipsized'" fontSize="16" />
19-
</label>
20-
<HTMLLabel backgroundColor="blue" rippleColor="green" borderRadius="10" paddingTop="0" height="80" width="80" lineBreak="end" maxLines="4">
19+
</label>
20+
<HTMLLabel backgroundColor="blue" rippleColor="green" borderRadius="10" paddingTop="0" height="80" width="80" lineBreak="end" maxLines="4" color="black">
2121
<span text="this is a tesxt to test lineBreak" fontSize="12" />
2222
<span :text="'\n' + 'another piece of text which is going to be ellipsized'" fontSize="16" />
23-
</HTMLLabel>
24-
23+
</HTMLLabel>
2524
</StackLayout>
2625
</Page>
2726
</template>
@@ -64,7 +63,7 @@ export default {
6463
return {
6564
mdiFontFamily: 'materialdesignicons-webfont,Material Design Icons',
6665
itemList: items,
67-
item:null
66+
item: null
6867
};
6968
},
7069
methods: {

packages/ui-canvas/CHANGELOG.md

Lines changed: 5 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -3,71 +3,46 @@
33
All notable changes to this project will be documented in this file.
44
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
55

6-
## [4.4.13](https://github.com/nativescript-community/ui-canvas/compare/@nativescript-community/[email protected]...@nativescript-community/[email protected]) (2023-05-16)
7-
8-
**Note:** Version bump only for package @nativescript-community/ui-canvas
6+
# [4.5.0](https://github.com/nativescript-community/ui-canvas/compare/@nativescript-community/[email protected]...@nativescript-community/[email protected]) (2023-07-05)
97

8+
### Features
109

10+
* **canvas:** ellipsize support for StaticLayout ([2b22e82](https://github.com/nativescript-community/ui-canvas/commit/2b22e82b1b2ef06dcf20162cf8798f60c2bcb2de))
1111

12+
## [4.4.13](https://github.com/nativescript-community/ui-canvas/compare/@nativescript-community/[email protected]...@nativescript-community/[email protected]) (2023-05-16)
1213

14+
**Note:** Version bump only for package @nativescript-community/ui-canvas
1315

1416
## [4.4.12](https://github.com/nativescript-community/ui-canvas/compare/@nativescript-community/[email protected]...@nativescript-community/[email protected]) (2023-02-26)
1517

1618
**Note:** Version bump only for package @nativescript-community/ui-canvas
1719

18-
19-
20-
21-
2220
## [4.4.11](https://github.com/nativescript-community/ui-canvas/compare/@nativescript-community/[email protected]...@nativescript-community/[email protected]) (2023-01-28)
2321

2422
**Note:** Version bump only for package @nativescript-community/ui-canvas
2523

26-
27-
28-
29-
3024
## [4.4.10](https://github.com/nativescript-community/ui-canvas/compare/@nativescript-community/[email protected]...@nativescript-community/[email protected]) (2023-01-24)
3125

32-
3326
### Bug Fixes
3427

3528
* **android:** native-api-usage fix ([3f82275](https://github.com/nativescript-community/ui-canvas/commit/3f82275755fe4f03bed8efc345379abe90f2baa7))
3629

37-
38-
39-
40-
4130
## [4.4.9](https://github.com/nativescript-community/ui-canvas/compare/@nativescript-community/[email protected]...@nativescript-community/[email protected]) (2023-01-24)
4231

4332
**Note:** Version bump only for package @nativescript-community/ui-canvas
4433

45-
46-
47-
48-
4934
## [4.4.8](https://github.com/nativescript-community/ui-canvas/compare/@nativescript-community/[email protected]...@nativescript-community/[email protected]) (2023-01-24)
5035

51-
5236
### Bug Fixes
5337

5438
* **android:** native-api-usage fix ([d47baa7](https://github.com/nativescript-community/ui-canvas/commit/d47baa7437a8f3efcf4a30af1bea31fb4afb4a66))
5539

56-
57-
58-
59-
6040
## 4.4.7 (2023-01-23)
6141

62-
6342
### Bug Fixes
6443

6544
* **android:** improved native-api-usage ([ac262b9](https://github.com/nativescript-community/ui-canvas/commit/ac262b977fa84d2d4a1c1b089822fa38a4601d16))
6645

67-
68-
69-
70-
7146
## [4.4.6](https://github.com/nativescript-community/ui-canvas/compare/v4.4.5...v4.4.6) (2022-12-16)
7247

7348
**Note:** Version bump only for package @nativescript-community/ui-canvas

packages/ui-canvas/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@nativescript-community/ui-canvas",
3-
"version": "4.4.13",
3+
"version": "4.5.0",
44
"description": "Implement Canvas into your NativeScript apps.",
55
"main": "./index",
66
"sideEffects": false,

packages/ui-canvas/platforms/ios/src/Drawing-Text.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ UIFont *FontForWrappedString(NSString *string, NSString *fontFace, CGRect rect,
3636
+ (void) drawAttributedStringInRect: (NSAttributedString *)string x:(CGFloat)x y:(CGFloat)y width:(CGFloat)width height:(CGFloat)height font:(UIFont*)font alignment:(NSTextAlignment)alignment color:(UIColor*)color;
3737
+ (void) drawString: (NSString *)string x:(CGFloat)x y:(CGFloat)y withAttributes:(NSDictionary*)attributes;
3838
+ (void) drawAttributedString: (NSAttributedString *)string x:(CGFloat)x y:(CGFloat)y withAttributes:(NSDictionary*)attributes;
39+
+ (void) drawAttributedString: (NSAttributedString *)string x:(CGFloat)x y:(CGFloat)y width:(CGFloat)width height:(CGFloat)height withAttributes:(NSDictionary*)attributes;
3940
+ (CGRect)getTextBounds:(NSString*)text from:(NSUInteger)from to:(NSUInteger)to attributes:(NSDictionary*)attributes;
4041
+ (CGFloat)measureText:(NSString*)text from:(NSUInteger)from to:(NSUInteger)to attributes:(NSDictionary*)attributes;
4142
@end

packages/ui-canvas/platforms/ios/src/Drawing-Text.m

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,9 @@ void DrawAttributedStringInRectWithAttrs(NSAttributedString *string, CGRect rect
119119
NSRange range = NSMakeRange(0, string.length);
120120
[attributedString addAttributes:attributes range:range];
121121

122-
CGRect destRect = [string boundingRectWithSize:CGSizeMake(rect.size.width, CGFLOAT_MAX) options:NSStringDrawingUsesLineFragmentOrigin context:nil];
123-
CGRect outputRect = RectCenteredInRect(destRect, rect);
124-
[attributedString drawInRect:outputRect];
122+
// CGRect destRect = [string boundingRectWithSize:CGSizeMake(rect.size.width, CGFLOAT_MAX) options:NSStringDrawingUsesLineFragmentOrigin|NSStringDrawingUsesFontLeading context:nil];
123+
// CGRect outputRect = RectCenteredInRect(destRect, rect);
124+
[attributedString drawWithRect:rect options:NSStringDrawingUsesLineFragmentOrigin|NSStringDrawingUsesFontLeading context:nil] ;
125125
}
126126

127127
#pragma mark - Unwrapped
@@ -286,6 +286,9 @@ + (void) drawString: (NSString *)string x:(CGFloat)x y:(CGFloat)y withAttributes
286286
+ (void) drawAttributedString: (NSAttributedString *)string x:(CGFloat)x y:(CGFloat)y withAttributes:(NSDictionary*)attributes{
287287
DrawAttributedStringAtPosWithAttrs(string, x, y, attributes);
288288
}
289+
+ (void) drawAttributedString: (NSAttributedString *)string x:(CGFloat)x y:(CGFloat)y width:(CGFloat)width height:(CGFloat)height withAttributes:(NSDictionary*)attributes {
290+
DrawAttributedStringInRectWithAttrs(string, CGRectMake (x, y, width, height), attributes);
291+
}
289292

290293
+ (CGRect)getTextBounds:(NSString*)text from:(NSUInteger)from to:(NSUInteger)to attributes:(NSDictionary*)attributes {
291294

packages/ui-canvaslabel/CHANGELOG.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,16 @@
33
All notable changes to this project will be documented in this file.
44
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
55

6-
# 1.2.0 (2023-05-16)
6+
## [1.2.1](https://github.com/nativescript-community/ui-canvas/compare/@nativescript-community/[email protected]...@nativescript-community/[email protected]) (2023-07-05)
7+
8+
**Note:** Version bump only for package @nativescript-community/ui-canvaslabel
79

10+
# 1.2.0 (2023-05-16)
811

912
### Features
1013

1114
* moved `@nativescript-community/ui-canvaslabel` here ([900538b](https://github.com/nativescript-community/ui-canvas/commit/900538b0f8f7eeac1285fcf001a4dd1e6e67f49a))
1215

13-
14-
15-
16-
1716
## [1.1.8](https://github.com/nativescript-community/ui-canvaslabel/compare/v1.1.7...v1.1.8) (2022-12-01)
1817

1918
**Note:** Version bump only for package @nativescript-community/ui-canvaslabel

packages/ui-canvaslabel/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@nativescript-community/ui-canvaslabel",
3-
"version": "1.2.0",
3+
"version": "1.2.1",
44
"description": "Alternative to the built-in NativeScript Label but uses canvas which allows extreme complexity and customization.",
55
"main": "./canvaslabel",
66
"sideEffects": false,
@@ -41,6 +41,6 @@
4141
},
4242
"dependencies": {
4343
"@nativescript-community/text": "^1.5.31",
44-
"@nativescript-community/ui-canvas": "^4.4.13"
44+
"@nativescript-community/ui-canvas": "^4.5.0"
4545
}
4646
}

packages/ui-svg/CHANGELOG.md

Lines changed: 3 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -3,68 +3,42 @@
33
All notable changes to this project will be documented in this file.
44
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
55

6-
## [0.1.9](https://github.com/nativescript-community/ui-canvas/compare/@nativescript-community/[email protected].8...@nativescript-community/[email protected].9) (2023-05-16)
6+
## [0.1.10](https://github.com/nativescript-community/ui-canvas/compare/@nativescript-community/[email protected].9...@nativescript-community/[email protected].10) (2023-07-05)
77

88
**Note:** Version bump only for package @nativescript-community/ui-svg
99

10+
## [0.1.9](https://github.com/nativescript-community/ui-canvas/compare/@nativescript-community/[email protected]...@nativescript-community/[email protected]) (2023-05-16)
1011

11-
12-
12+
**Note:** Version bump only for package @nativescript-community/ui-svg
1313

1414
## [0.1.8](https://github.com/nativescript-community/ui-canvas/compare/@nativescript-community/[email protected]...@nativescript-community/[email protected]) (2023-02-26)
1515

1616
**Note:** Version bump only for package @nativescript-community/ui-svg
1717

18-
19-
20-
21-
2218
## [0.1.7](https://github.com/nativescript-community/ui-canvas/compare/@nativescript-community/[email protected]...@nativescript-community/[email protected]) (2023-01-28)
2319

24-
2520
### Bug Fixes
2621

2722
* **ui-svg:** android fix native-api-usage ([e7df868](https://github.com/nativescript-community/ui-canvas/commit/e7df868526761be7611731c41111b82138fc939c))
2823

29-
30-
31-
32-
3324
## [0.1.6](https://github.com/nativescript-community/ui-canvas/compare/@nativescript-community/[email protected]...@nativescript-community/[email protected]) (2023-01-24)
3425

3526
**Note:** Version bump only for package @nativescript-community/ui-svg
3627

37-
38-
39-
40-
4128
## [0.1.5](https://github.com/nativescript-community/ui-canvas/compare/@nativescript-community/[email protected]...@nativescript-community/[email protected]) (2023-01-24)
4229

4330
**Note:** Version bump only for package @nativescript-community/ui-svg
4431

45-
46-
47-
48-
4932
## [0.1.4](https://github.com/nativescript-community/ui-canvas/compare/@nativescript-community/[email protected]...@nativescript-community/[email protected]) (2023-01-24)
5033

5134
**Note:** Version bump only for package @nativescript-community/ui-svg
5235

53-
54-
55-
56-
5736
## 0.1.3 (2023-01-23)
5837

59-
6038
### Bug Fixes
6139

6240
* **android:** improved native-api-usage ([ac262b9](https://github.com/nativescript-community/ui-canvas/commit/ac262b977fa84d2d4a1c1b089822fa38a4601d16))
6341

64-
65-
66-
67-
6842
## [0.1.2](https://github.com/nativescript-community/ui-svg/compare/v0.1.1...v0.1.2) (2022-12-01)
6943

7044
**Note:** Version bump only for package @nativescript-community/ui-svg

packages/ui-svg/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@nativescript-community/ui-svg",
3-
"version": "0.1.9",
3+
"version": "0.1.10",
44
"description": "Adds support for SVGs in your NativeScript apps.",
55
"main": "./index",
66
"sideEffects": false,
@@ -40,6 +40,6 @@
4040
"url": "https://github.com/nativescript-community/ui-canvas/issues"
4141
},
4242
"dependencies": {
43-
"@nativescript-community/ui-canvas": "^4.4.13"
43+
"@nativescript-community/ui-canvas": "^4.5.0"
4444
}
4545
}

0 commit comments

Comments
 (0)