@maccesar/titools 2.2.4 → 2.2.9

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.
Files changed (98) hide show
  1. package/README.md +23 -23
  2. package/agents/ti-pro.md +17 -17
  3. package/lib/commands/update.js +6 -14
  4. package/lib/downloader.js +17 -2
  5. package/package.json +1 -1
  6. package/skills/alloy-guides/SKILL.md +31 -31
  7. package/skills/alloy-guides/references/CONCEPTS.md +3 -3
  8. package/skills/alloy-guides/references/CONTROLLERS.md +1 -1
  9. package/skills/alloy-guides/references/MODELS.md +6 -6
  10. package/skills/alloy-guides/references/VIEWS_WITHOUT_CONTROLLERS.md +1 -1
  11. package/skills/alloy-guides/references/VIEWS_XML.md +1 -1
  12. package/skills/alloy-guides/references/WIDGETS.md +1 -1
  13. package/skills/alloy-howtos/SKILL.md +27 -27
  14. package/skills/alloy-howtos/references/best_practices.md +9 -9
  15. package/skills/alloy-howtos/references/cli_reference.md +14 -14
  16. package/skills/alloy-howtos/references/config_files.md +16 -16
  17. package/skills/alloy-howtos/references/custom_tags.md +16 -16
  18. package/skills/alloy-howtos/references/debugging_troubleshooting.md +11 -15
  19. package/skills/alloy-howtos/references/samples.md +19 -19
  20. package/skills/purgetss/SKILL.md +11 -1
  21. package/skills/purgetss/references/animation-system.md +1 -1
  22. package/skills/purgetss/references/cli-commands.md +3 -3
  23. package/skills/purgetss/references/customization-deep-dive.md +1 -1
  24. package/skills/purgetss/references/dynamic-component-creation.md +1 -1
  25. package/skills/purgetss/references/icon-fonts.md +4 -0
  26. package/skills/purgetss/references/installation-setup.md +8 -1
  27. package/skills/purgetss/references/migration-guide.md +4 -0
  28. package/skills/purgetss/references/tikit-components.md +193 -204
  29. package/skills/purgetss/references/ui-ux-design.md +1 -1
  30. package/skills/ti-expert/SKILL.md +78 -118
  31. package/skills/ti-expert/references/alloy-builtins.md +18 -18
  32. package/skills/ti-expert/references/alloy-structure.md +21 -21
  33. package/skills/ti-expert/references/anti-patterns.md +15 -15
  34. package/skills/ti-expert/references/cli-expert.md +15 -15
  35. package/skills/ti-expert/references/code-conventions.md +38 -38
  36. package/skills/ti-expert/references/contracts.md +8 -8
  37. package/skills/ti-expert/references/controller-patterns.md +14 -14
  38. package/skills/ti-expert/references/error-handling.md +11 -11
  39. package/skills/ti-expert/references/examples.md +12 -12
  40. package/skills/ti-expert/references/migration-patterns.md +24 -24
  41. package/skills/ti-expert/references/patterns.md +10 -10
  42. package/skills/ti-expert/references/performance-listview.md +16 -16
  43. package/skills/ti-expert/references/performance-optimization.md +41 -41
  44. package/skills/ti-expert/references/security-device.md +22 -22
  45. package/skills/ti-expert/references/security-fundamentals.md +19 -19
  46. package/skills/ti-expert/references/state-management.md +33 -33
  47. package/skills/ti-expert/references/testing-e2e-ci.md +25 -25
  48. package/skills/ti-expert/references/testing-unit.md +24 -24
  49. package/skills/ti-expert/references/theming.md +15 -15
  50. package/skills/ti-guides/SKILL.md +58 -60
  51. package/skills/ti-guides/references/advanced-data-and-images.md +33 -33
  52. package/skills/ti-guides/references/android-manifest.md +15 -15
  53. package/skills/ti-guides/references/app-distribution.md +70 -166
  54. package/skills/ti-guides/references/application-frameworks.md +96 -114
  55. package/skills/ti-guides/references/cli-reference.md +294 -294
  56. package/skills/ti-guides/references/coding-best-practices.md +42 -33
  57. package/skills/ti-guides/references/commonjs-advanced.md +57 -51
  58. package/skills/ti-guides/references/hello-world.md +36 -36
  59. package/skills/ti-guides/references/hyperloop-native-access.md +66 -66
  60. package/skills/ti-guides/references/javascript-primer.md +83 -101
  61. package/skills/ti-guides/references/reserved-words.md +9 -9
  62. package/skills/ti-guides/references/resources.md +75 -83
  63. package/skills/ti-guides/references/style-and-conventions.md +35 -28
  64. package/skills/ti-guides/references/tiapp-config.md +110 -74
  65. package/skills/ti-howtos/SKILL.md +88 -92
  66. package/skills/ti-howtos/references/android-platform-deep-dives.md +104 -104
  67. package/skills/ti-howtos/references/automation-fastlane-appium.md +39 -39
  68. package/skills/ti-howtos/references/buffer-codec-streams.md +60 -60
  69. package/skills/ti-howtos/references/cross-platform-development.md +115 -136
  70. package/skills/ti-howtos/references/debugging-profiling.md +167 -181
  71. package/skills/ti-howtos/references/extending-titanium.md +121 -121
  72. package/skills/ti-howtos/references/google-maps-v2.md +84 -82
  73. package/skills/ti-howtos/references/ios-map-kit.md +65 -60
  74. package/skills/ti-howtos/references/ios-platform-deep-dives.md +123 -123
  75. package/skills/ti-howtos/references/local-data-sources.md +79 -78
  76. package/skills/ti-howtos/references/location-and-maps.md +116 -120
  77. package/skills/ti-howtos/references/media-apis.md +87 -86
  78. package/skills/ti-howtos/references/notification-services.md +250 -260
  79. package/skills/ti-howtos/references/remote-data-sources.md +98 -93
  80. package/skills/ti-howtos/references/tutorials.md +226 -216
  81. package/skills/ti-howtos/references/using-modules.md +73 -102
  82. package/skills/ti-howtos/references/web-content-integration.md +101 -103
  83. package/skills/ti-howtos/references/webpack-build-pipeline.md +52 -44
  84. package/skills/ti-ui/SKILL.md +85 -85
  85. package/skills/ti-ui/references/accessibility-deep-dive.md +57 -57
  86. package/skills/ti-ui/references/animation-and-matrices.md +79 -79
  87. package/skills/ti-ui/references/application-structures.md +96 -99
  88. package/skills/ti-ui/references/custom-fonts-styling.md +99 -99
  89. package/skills/ti-ui/references/event-handling.md +58 -58
  90. package/skills/ti-ui/references/gestures.md +62 -64
  91. package/skills/ti-ui/references/icons-and-splash-screens.md +88 -88
  92. package/skills/ti-ui/references/layouts-and-positioning.md +87 -97
  93. package/skills/ti-ui/references/listviews-and-performance.md +107 -107
  94. package/skills/ti-ui/references/orientation.md +87 -88
  95. package/skills/ti-ui/references/platform-ui-android.md +87 -81
  96. package/skills/ti-ui/references/platform-ui-ios.md +63 -61
  97. package/skills/ti-ui/references/scrolling-views.md +29 -29
  98. package/skills/ti-ui/references/tableviews.md +56 -56
@@ -1,30 +1,32 @@
1
1
  # Google Maps v2 for Android
2
2
 
3
- Guide for implementing native maps on Android using the `ti.map` module (v2).
3
+ Guide to implementing native maps on Android using the `ti.map` module (v2).
4
4
 
5
- ## 1. Initial Configuration
5
+ ## 1. Initial configuration
6
+
7
+ ### Module installation
8
+ Add the module to `tiapp.xml`:
6
9
 
7
- ### Module Installation
8
- Add the module to your `tiapp.xml`:
9
10
  ```xml
10
11
  <modules>
11
12
  <module platform="android">ti.map</module>
12
13
  </modules>
13
14
  ```
14
15
 
15
- ### Obtaining an API Key (Google Cloud Console)
16
- 1. Create a project in the [Google Cloud Console](https://console.cloud.google.com/).
16
+ ### Obtaining an API key (Google Cloud Console)
17
+ 1. Create a project in the Google Cloud Console.
17
18
  2. Enable "Maps SDK for Android".
18
- 3. Generate an API Key. You will need the **Application ID** from your `tiapp.xml` and the **SHA-1 fingerprint** from your keystore.
19
+ 3. Generate an API key. You will need the application ID from your `tiapp.xml` and the SHA-1 fingerprint from your keystore.
19
20
 
20
- #### Get SHA-1 (Debug)
21
+ #### Get SHA-1 (debug)
21
22
  ```bash
22
23
  keytool -list -v -keystore ~/Library/Application\ Support/titanium/mobilesdk/osx/<VERSION>/android/dev_keystore
23
24
  ```
24
- *Default password: <empty> (press Enter)*
25
+ Default password: empty (press Enter).
25
26
 
26
27
  ### Configure tiapp.xml
27
- Add the API Key in the Android section:
28
+ Add the API key in the Android section:
29
+
28
30
  ```xml
29
31
  <android xmlns:android="http://schemas.android.com/apk/res/android">
30
32
  <manifest>
@@ -35,136 +37,136 @@ Add the API Key in the Android section:
35
37
  </android>
36
38
  ```
37
39
 
38
- ## 2. Google Play Services Verification
40
+ ## 2. Google Play Services verification
39
41
 
40
- It is mandatory to verify availability before rendering the map:
42
+ Verify availability before rendering the map:
41
43
 
42
44
  ```javascript
43
45
  const MapModule = require('ti.map');
44
46
  const rc = MapModule.isGooglePlayServicesAvailable();
45
47
 
46
48
  switch (rc) {
47
- case MapModule.SUCCESS:
48
- Ti.API.info('Google Play Services available');
49
- break;
50
- case MapModule.SERVICE_MISSING:
51
- Ti.API.error('Google Play Services is missing');
52
- break;
53
- case MapModule.SERVICE_VERSION_UPDATE_REQUIRED:
54
- Ti.API.error('Google Play Services needs update');
55
- break;
56
- case MapModule.SERVICE_DISABLED:
57
- Ti.API.error('Google Play Services is disabled');
58
- break;
59
- case MapModule.SERVICE_INVALID:
60
- Ti.API.error('Google Play Services is invalid');
61
- break;
49
+ case MapModule.SUCCESS:
50
+ Ti.API.info('Google Play Services available');
51
+ break;
52
+ case MapModule.SERVICE_MISSING:
53
+ Ti.API.error('Google Play Services is missing');
54
+ break;
55
+ case MapModule.SERVICE_VERSION_UPDATE_REQUIRED:
56
+ Ti.API.error('Google Play Services needs update');
57
+ break;
58
+ case MapModule.SERVICE_DISABLED:
59
+ Ti.API.error('Google Play Services is disabled');
60
+ break;
61
+ case MapModule.SERVICE_INVALID:
62
+ Ti.API.error('Google Play Services is invalid');
63
+ break;
62
64
  }
63
65
  ```
64
66
 
65
- ## 3. Using the Map View
67
+ ## 3. Using the map view
66
68
 
67
- ### Basic Creation
69
+ ### Basic creation
68
70
  ```javascript
69
71
  const MapModule = require('ti.map');
70
72
  const mapView = MapModule.createView({
71
- mapType: MapModule.NORMAL_TYPE,
72
- userLocation: true,
73
- traffic: true, // Show real-time traffic
74
- animate: true,
75
- region: {
76
- latitude: -33.87365,
77
- longitude: 151.20689,
78
- latitudeDelta: 0.1,
79
- longitudeDelta: 0.1
80
- }
73
+ mapType: MapModule.NORMAL_TYPE,
74
+ userLocation: true,
75
+ traffic: true, // Show real-time traffic
76
+ animate: true,
77
+ region: {
78
+ latitude: -33.87365,
79
+ longitude: 151.20689,
80
+ latitudeDelta: 0.1,
81
+ longitudeDelta: 0.1
82
+ }
81
83
  });
82
84
  ```
83
85
 
84
- ### Map Types
85
- - `MapModule.NORMAL_TYPE`: Standard map.
86
- - `MapModule.SATELLITE_TYPE`: Satellite imagery.
87
- - `MapModule.TERRAIN_TYPE`: Terrain map.
88
- - `MapModule.HYBRID_TYPE`: Satellite with labels.
86
+ ### Map types
87
+ - `MapModule.NORMAL_TYPE`: standard map
88
+ - `MapModule.SATELLITE_TYPE`: satellite imagery
89
+ - `MapModule.TERRAIN_TYPE`: terrain map
90
+ - `MapModule.HYBRID_TYPE`: satellite with labels
89
91
 
90
- ## 4. Advanced Annotations (Pins)
92
+ ## 4. Advanced annotations (pins)
91
93
 
92
94
  ```javascript
93
95
  const opera = MapModule.createAnnotation({
94
- latitude: -33.8569,
95
- longitude: 151.2153,
96
- title: 'Sydney Opera House',
97
- subtitle: 'NSW, Australia',
98
- pincolor: MapModule.ANNOTATION_VIOLET,
99
- image: 'custom_pin.png', // Custom image
100
- draggable: true, // Allow pin dragging
101
- // Complete custom view (replaces the pin)
102
- customView: Ti.UI.createLabel({ text: '📍', backgroundColor: 'white' })
96
+ latitude: -33.8569,
97
+ longitude: 151.2153,
98
+ title: 'Sydney Opera House',
99
+ subtitle: 'NSW, Australia',
100
+ pincolor: MapModule.ANNOTATION_VIOLET,
101
+ image: 'custom_pin.png', // Custom image
102
+ draggable: true, // Allow pin dragging
103
+ // Complete custom view (replaces the pin)
104
+ customView: Ti.UI.createLabel({ text: 'Pin', backgroundColor: 'white' })
103
105
  });
104
106
 
105
107
  mapView.addAnnotation(opera);
106
108
  ```
107
109
 
108
- ### Additional Annotation Properties
109
- - `customView` a `Ti.UI.View` that replaces the entire annotation (takes precedence over `image`)
110
- - `centerOffset` `{x, y}` point to offset the annotation from the coordinate
111
- - `canShowCallout` whether tapping shows the info bubble (default: `true`)
110
+ ### Additional annotation properties
111
+ - `customView`: a `Ti.UI.View` that replaces the entire annotation (takes precedence over `image`)
112
+ - `centerOffset`: `{x, y}` offset for the annotation relative to the coordinate
113
+ - `canShowCallout`: whether tapping shows the info bubble (default: `true`)
112
114
 
113
- > **Precedence**: `customView` > `image` > default pin. For buttons: `leftView`/`rightView` take precedence over `leftButton`/`rightButton`.
115
+ Precedence: `customView` > `image` > default pin. For buttons: `leftView`/`rightView` take precedence over `leftButton`/`rightButton`.
114
116
 
115
- ### Available Pin Colors
117
+ ### Available pin colors
116
118
  `ANNOTATION_AZURE`, `BLUE`, `CYAN`, `GREEN`, `MAGENTA`, `ORANGE`, `RED`, `ROSE`, `VIOLET`, `YELLOW`.
117
119
 
118
- ## 5. Routes (Polylines)
120
+ ## 5. Routes (polylines)
119
121
 
120
122
  ```javascript
121
123
  const route = MapModule.createRoute({
122
- width: 5,
123
- color: '#f00',
124
- points: [
125
- { latitude: -33.8569, longitude: 151.2153 },
126
- { latitude: -33.8522, longitude: 151.2105 }
127
- ]
124
+ width: 5,
125
+ color: '#f00',
126
+ points: [
127
+ { latitude: -33.8569, longitude: 151.2153 },
128
+ { latitude: -33.8522, longitude: 151.2105 }
129
+ ]
128
130
  });
129
131
 
130
132
  mapView.addRoute(route);
131
133
  ```
132
134
 
133
- ## 6. Critical Events
135
+ ## 6. Critical events
134
136
 
135
137
  ```javascript
136
138
  // Detect click on annotation or its buttons
137
139
  mapView.addEventListener('click', (e) => {
138
- if (e.clicksource === 'pin') {
139
- Ti.API.info(`Pin clicked: ${e.title}`);
140
- }
140
+ if (e.clicksource === 'pin') {
141
+ Ti.API.info(`Pin clicked: ${e.title}`);
142
+ }
141
143
  });
142
144
 
143
145
  // Detect drag state changes
144
146
  mapView.addEventListener('pinchangedragstate', (e) => {
145
- if (e.annotation.dragState === MapModule.ANNOTATION_DRAG_STATE_END) {
146
- Ti.API.info(`Dropped at: ${e.annotation.latitude}, ${e.annotation.longitude}`);
147
- }
147
+ if (e.annotation.dragState === MapModule.ANNOTATION_DRAG_STATE_END) {
148
+ Ti.API.info(`Dropped at: ${e.annotation.latitude}, ${e.annotation.longitude}`);
149
+ }
148
150
  });
149
151
  // Drag states: ANNOTATION_DRAG_STATE_START, ANNOTATION_DRAG_STATE_DRAG,
150
152
  // ANNOTATION_DRAG_STATE_CANCEL, ANNOTATION_DRAG_STATE_END
151
153
 
152
154
  // Detect region changes
153
155
  mapView.addEventListener('regionchanged', (e) => {
154
- Ti.API.info(`New region: ${e.latitude}, ${e.longitude} (delta: ${e.latitudeDelta}, ${e.longitudeDelta})`);
156
+ Ti.API.info(`New region: ${e.latitude}, ${e.longitude} (delta: ${e.latitudeDelta}, ${e.longitudeDelta})`);
155
157
  });
156
158
 
157
159
  // Detect complete rendering
158
160
  mapView.addEventListener('complete', (e) => {
159
- Ti.API.info('Map loaded');
161
+ Ti.API.info('Map loaded');
160
162
  });
161
163
  ```
162
164
 
163
- ## 7. Migration from Legacy Titanium.Map
165
+ ## 7. Migration from legacy Titanium.Map
164
166
 
165
- > **Note**: The `ti.map` module replaced the legacy `Titanium.Map` API. Key differences: use `NORMAL_TYPE` instead of `STANDARD_TYPE`, `ANNOTATION_VIOLET` instead of `ANNOTATION_PURPLE`, and routes are created with `Map.createRoute()` instead of abstract data types. Multiple MapView instances are supported.
167
+ The `ti.map` module replaced the legacy `Titanium.Map` API. Key differences: use `NORMAL_TYPE` instead of `STANDARD_TYPE`, `ANNOTATION_VIOLET` instead of `ANNOTATION_PURPLE`, and routes are created with `Map.createRoute()` instead of abstract data types. Multiple MapView instances are supported.
166
168
 
167
- ## 8. Limitations and Troubleshooting
168
- - **Single Map:** Android (legacy) only allows one MapView instance per application. v2 allows multiple views.
169
- - **Blank Map:** Verify the API Key is correct and that `android:anyDensity` is NOT set to true in the manifest if using old resolutions.
170
- - **Simulator:** Google Maps v2 is NOT compatible with the standard emulator without x86 Google Play Services. Real device testing is recommended.
169
+ ## 8. Limitations and troubleshooting
170
+ - Single map: Android (legacy) only allows one MapView instance per application. v2 allows multiple views.
171
+ - Blank map: verify the API key and make sure `android:anyDensity` is not set to true in the manifest if you use old resolutions.
172
+ - Simulator: Google Maps v2 is not compatible with the standard emulator without x86 Google Play Services. Test on a real device.
@@ -1,19 +1,21 @@
1
1
  # iOS Map Kit
2
2
 
3
- Guide for implementing native maps on iOS using the `ti.map` module.
3
+ Guide to implementing native maps on iOS with the `ti.map` module.
4
4
 
5
- ## 1. Initial Configuration
5
+ ## 1. Initial configuration
6
+
7
+ ### Module installation
8
+ Add the module to `tiapp.xml`:
6
9
 
7
- ### Module Installation
8
- Add the module to your `tiapp.xml`:
9
10
  ```xml
10
11
  <modules>
11
12
  <module platform="iphone">ti.map</module>
12
13
  </modules>
13
14
  ```
14
15
 
15
- ### Location Permissions (Info.plist)
16
- Add the mandatory usage descriptions in `tiapp.xml`:
16
+ ### Location permissions (Info.plist)
17
+ Add the required usage descriptions in `tiapp.xml`:
18
+
17
19
  ```xml
18
20
  <ios>
19
21
  <plist>
@@ -27,93 +29,95 @@ Add the mandatory usage descriptions in `tiapp.xml`:
27
29
  </ios>
28
30
  ```
29
31
 
30
- > **iOS 11+**: You must include both `NSLocationWhenInUseUsageDescription` AND `NSLocationAlwaysAndWhenInUseUsageDescription` in your plist. Users can choose "When in Use" even when your app requests "Always" authorization.
32
+ iOS 11+: include both `NSLocationWhenInUseUsageDescription` and `NSLocationAlwaysAndWhenInUseUsageDescription`. Users can still choose "When in Use" even if you request "Always".
31
33
 
32
- ## 2. Using the Map View
34
+ ## 2. Using the map view
33
35
 
34
- ### Basic Creation
36
+ ### Basic creation
35
37
  ```javascript
36
38
  const MapModule = require('ti.map');
37
39
  const mapView = MapModule.createView({
38
- mapType: MapModule.NORMAL_TYPE, // Also: SATELLITE_TYPE, HYBRID_TYPE, STANDARD_TYPE (alias for NORMAL_TYPE with labels)
39
- userLocation: true,
40
- rotatesEnabled: true, // Allow two-finger rotation
41
- region: {
42
- latitude: 48.8582,
43
- longitude: 2.2945,
44
- latitudeDelta: 0.02,
45
- longitudeDelta: 0.02
46
- }
40
+ mapType: MapModule.NORMAL_TYPE, // Also: SATELLITE_TYPE, HYBRID_TYPE, STANDARD_TYPE (alias for NORMAL_TYPE with labels)
41
+ userLocation: true,
42
+ rotatesEnabled: true, // Allow two-finger rotation
43
+ region: {
44
+ latitude: 48.8582,
45
+ longitude: 2.2945,
46
+ latitudeDelta: 0.02,
47
+ longitudeDelta: 0.02
48
+ }
47
49
  });
48
50
  ```
49
51
 
50
- ## 3. 3D Camera (Perspective)
52
+ ## 3. 3D camera (perspective)
51
53
 
52
- iOS allows tilting and rotating the map programmatically for 3D views.
54
+ iOS lets you tilt and rotate the map for 3D views.
53
55
 
54
- > **Important**: The map view must be visible on screen before using camera APIs. Wait for the map's `complete` event before calling `animateCamera()` or setting camera properties.
56
+ Important: the map must be visible on screen before using camera APIs. Wait for the `complete` event before calling `animateCamera()` or setting camera properties.
55
57
 
56
58
  ```javascript
57
59
  const myCam = MapModule.createCamera({
58
- altitude: 300, // Meters above ground
59
- centerCoordinate: { latitude: 48.8582, longitude: 2.2945 },
60
- heading: -45, // Angle relative to North
61
- pitch: 60 // Tilt angle downward
60
+ altitude: 300, // meters above ground
61
+ centerCoordinate: { latitude: 48.8582, longitude: 2.2945 },
62
+ heading: -45, // angle relative to North
63
+ pitch: 60 // tilt angle downward
62
64
  });
63
65
 
64
66
  // Apply camera with animation
65
67
  mapView.animateCamera({
66
- camera: myCam,
67
- curve: Ti.UI.ANIMATION_CURVE_EASE_IN,
68
- duration: 1000
68
+ camera: myCam,
69
+ curve: Ti.UI.ANIMATION_CURVE_EASE_IN,
70
+ duration: 1000
69
71
  });
70
72
 
71
73
  // Additional 3D view properties
72
74
  mapView.pitchEnabled = true;
73
- mapView.showsBuildings = true; // 3D Buildings
75
+ mapView.showsBuildings = true; // 3D buildings
74
76
  ```
75
77
 
76
- ## 4. iOS Annotations
78
+ ## 4. iOS annotations
77
79
 
78
- ### System Buttons and Callouts
79
- iOS allows using native buttons inside the pin's callout (popup window).
80
+ ### System buttons and callouts
81
+ iOS allows native buttons in the pin callout (popup window).
80
82
 
81
83
  ```javascript
82
84
  const bridge = MapModule.createAnnotation({
83
- latitude: -33.8522,
84
- longitude: 151.2105,
85
- title: 'Harbour Bridge',
86
- subtitle: 'Port Jackson',
87
- pincolor: MapModule.ANNOTATION_PURPLE,
88
- // iOS system buttons in the callout
89
- leftButton: Ti.UI.iOS.SystemButton.INFO_DARK,
90
- rightButton: Ti.UI.iOS.SystemButton.CONTACT_ADD,
91
- canShowCallout: true // Controls whether tapping the annotation shows the callout bubble (default: true)
85
+ latitude: -33.8522,
86
+ longitude: 151.2105,
87
+ title: 'Harbour Bridge',
88
+ subtitle: 'Port Jackson',
89
+ pincolor: MapModule.ANNOTATION_PURPLE,
90
+ // iOS system buttons in the callout
91
+ leftButton: Ti.UI.iOS.SystemButton.INFO_DARK,
92
+ rightButton: Ti.UI.iOS.SystemButton.CONTACT_ADD,
93
+ canShowCallout: true // Controls whether tapping the annotation shows the callout bubble (default: true)
92
94
  });
93
95
 
94
96
  mapView.addAnnotation(bridge);
95
97
  ```
96
98
 
97
- ### Center Offset
98
- If using a custom pin image that is not centered:
99
+ ### Center offset
100
+ If you use a custom pin image that is not centered:
101
+
99
102
  ```javascript
100
103
  const customPin = MapModule.createAnnotation({
101
- image: 'flag.png',
102
- centerOffset: { x: 10, y: -20 } // Visually moves the pin
104
+ image: 'flag.png',
105
+ centerOffset: { x: 10, y: -20 } // Visually moves the pin
103
106
  });
104
107
  ```
105
108
 
106
- ## 5. Advanced Routes
109
+ ## 5. Advanced routes
110
+
111
+ ### Overlay levels
112
+ Control whether the route appears above labels or above roads.
107
113
 
108
- ### Overlay Levels
109
- Control if the route goes above labels or above roads.
110
114
  ```javascript
111
115
  const route = MapModule.createRoute({
112
- points: routePoints,
113
- color: '#00f',
114
- width: 4,
115
- level: MapModule.OVERLAY_LEVEL_ABOVE_LABELS // default
116
- // or MapModule.OVERLAY_LEVEL_ABOVE_ROADS (below labels)
116
+ points: routePoints,
117
+ color: '#00f',
118
+ width: 4,
119
+ level: MapModule.OVERLAY_LEVEL_ABOVE_LABELS // default
120
+ // or MapModule.OVERLAY_LEVEL_ABOVE_ROADS (below labels)
117
121
  });
118
122
  ```
119
123
 
@@ -121,17 +125,18 @@ const route = MapModule.createRoute({
121
125
 
122
126
  Key map events: `click`, `complete` (map loaded), `regionchanged`, `pinchangedragstate`.
123
127
 
124
- Same as Android, but with specialized `clicksource` for system buttons:
128
+ Same as Android, but with specialized `clicksource` values for system buttons:
129
+
125
130
  ```javascript
126
131
  mapView.addEventListener('click', (e) => {
127
- if (e.clicksource === 'leftButton' || e.clicksource === 'rightButton') {
128
- Ti.API.info('Callout button clicked');
129
- }
132
+ if (e.clicksource === 'leftButton' || e.clicksource === 'rightButton') {
133
+ Ti.API.info('Callout button clicked');
134
+ }
130
135
  });
131
136
 
132
137
  mapView.addEventListener('pinchangedragstate', (e) => {
133
- if (e.annotation.dragState === MapModule.ANNOTATION_DRAG_STATE_END) {
134
- Ti.API.info(`Dropped at: ${e.annotation.latitude}, ${e.annotation.longitude}`);
135
- }
138
+ if (e.annotation.dragState === MapModule.ANNOTATION_DRAG_STATE_END) {
139
+ Ti.API.info(`Dropped at: ${e.annotation.latitude}, ${e.annotation.longitude}`);
140
+ }
136
141
  });
137
142
  ```