@nativescript/canvas 2.0.0-beta.1 → 2.0.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nativescript/canvas",
3
- "version": "2.0.0-beta.1",
3
+ "version": "2.0.0-beta.2",
4
4
  "description": "DOM Canvas API for NativeScript",
5
5
  "main": "index",
6
6
  "typings": "index.d.ts",
@@ -8,32 +8,32 @@
8
8
  <key>DebugSymbolsPath</key>
9
9
  <string>dSYMs</string>
10
10
  <key>LibraryIdentifier</key>
11
- <string>ios-arm64</string>
11
+ <string>ios-arm64_x86_64-simulator</string>
12
12
  <key>LibraryPath</key>
13
13
  <string>CanvasNative.framework</string>
14
14
  <key>SupportedArchitectures</key>
15
15
  <array>
16
16
  <string>arm64</string>
17
+ <string>x86_64</string>
17
18
  </array>
18
19
  <key>SupportedPlatform</key>
19
20
  <string>ios</string>
21
+ <key>SupportedPlatformVariant</key>
22
+ <string>simulator</string>
20
23
  </dict>
21
24
  <dict>
22
25
  <key>DebugSymbolsPath</key>
23
26
  <string>dSYMs</string>
24
27
  <key>LibraryIdentifier</key>
25
- <string>ios-arm64_x86_64-simulator</string>
28
+ <string>ios-arm64</string>
26
29
  <key>LibraryPath</key>
27
30
  <string>CanvasNative.framework</string>
28
31
  <key>SupportedArchitectures</key>
29
32
  <array>
30
33
  <string>arm64</string>
31
- <string>x86_64</string>
32
34
  </array>
33
35
  <key>SupportedPlatform</key>
34
36
  <string>ios</string>
35
- <key>SupportedPlatformVariant</key>
36
- <string>simulator</string>
37
37
  </dict>
38
38
  </array>
39
39
  <key>CFBundlePackageType</key>
@@ -2011,33 +2011,19 @@ CanvasRenderingContext2DImpl::Fill(const v8::FunctionCallbackInfo<v8::Value> &ar
2011
2011
 
2012
2012
  if (object != nullptr) {
2013
2013
  auto rule = args[1]->Uint32Value(context).ToChecked();
2014
- switch (rule) {
2015
- case 0:
2016
- case 1:
2017
- canvas_native_context_fill_with_path(
2018
- ptr->GetContext(),
2019
- object->GetPath(), rule);
2020
- ptr->UpdateInvalidateState();
2021
- break;
2022
- default:
2023
- break;
2024
- }
2025
-
2014
+ canvas_native_context_fill_with_path(
2015
+ ptr->GetContext(),
2016
+ object->GetPath(), rule);
2017
+ ptr->UpdateInvalidateState();
2026
2018
  }
2027
2019
  }
2028
2020
  } else if (count == 1) {
2029
- if (value->IsInt32()) {
2030
- auto rule = args[1]->Uint32Value(context).ToChecked();
2031
- switch (rule) {
2032
- case 0:
2033
- canvas_native_context_fill(
2034
- ptr->GetContext(),
2035
- rule);
2036
- ptr->UpdateInvalidateState();
2037
- break;
2038
- default:
2039
- break;
2040
- }
2021
+ if (value->IsUint32()) {
2022
+ auto rule = value->Uint32Value(context).ToChecked();
2023
+ canvas_native_context_fill(
2024
+ ptr->GetContext(),
2025
+ rule);
2026
+ ptr->UpdateInvalidateState();
2041
2027
  } else if (value->IsObject()) {
2042
2028
  auto type = GetNativeType(value.As<v8::Object>());
2043
2029
  if (type == NativeType::Path2D) {
@@ -2190,16 +2176,8 @@ CanvasRenderingContext2DImpl::IsPointInPath(const v8::FunctionCallbackInfo<v8::V
2190
2176
  auto x = static_cast<float>(args[0]->NumberValue(context).ToChecked());
2191
2177
  auto y = static_cast<float>(args[1]->NumberValue(context).ToChecked());
2192
2178
  auto rule = args[2]->Uint32Value(context).ToChecked();
2193
- bool ret = false;
2194
- switch (rule) {
2195
- case 0:
2196
- case 1:
2197
- ret = canvas_native_context_is_point_in_path(
2198
- ptr->GetContext(), x, y, rule);
2199
- break;
2200
- default:
2201
- break;
2202
- }
2179
+ bool ret = canvas_native_context_is_point_in_path(
2180
+ ptr->GetContext(), x, y, rule);
2203
2181
  args.GetReturnValue().Set(ret);
2204
2182
  return;
2205
2183
  } else if (count == 4 &&
@@ -2214,20 +2192,12 @@ CanvasRenderingContext2DImpl::IsPointInPath(const v8::FunctionCallbackInfo<v8::V
2214
2192
  auto x = static_cast<float>(args[1]->NumberValue(context).ToChecked());
2215
2193
  auto y = static_cast<float>(args[2]->NumberValue(context).ToChecked());
2216
2194
  auto rule = args[3]->Uint32Value(context).ToChecked();
2217
- bool ret = false;
2218
2195
 
2219
2196
  if (path != nullptr) {
2220
2197
 
2221
- switch (rule) {
2222
- case 0:
2223
- case 1:
2224
- ret = canvas_native_context_is_point_in_path_with_path(
2225
- ptr->GetContext(),
2226
- path->GetPath(), x, y, rule);
2227
- break;
2228
- default:
2229
- break;
2230
- }
2198
+ bool ret = canvas_native_context_is_point_in_path_with_path(
2199
+ ptr->GetContext(),
2200
+ path->GetPath(), x, y, rule);
2231
2201
 
2232
2202
  args.GetReturnValue().Set(ret);
2233
2203
  return;