@maccesar/titools 2.2.4 → 2.2.8
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/README.md +23 -23
- package/lib/commands/update.js +4 -12
- package/package.json +1 -1
- package/skills/alloy-guides/SKILL.md +31 -31
- package/skills/alloy-guides/references/CONCEPTS.md +3 -3
- package/skills/alloy-guides/references/CONTROLLERS.md +1 -1
- package/skills/alloy-guides/references/MODELS.md +6 -6
- package/skills/alloy-guides/references/VIEWS_WITHOUT_CONTROLLERS.md +1 -1
- package/skills/alloy-guides/references/VIEWS_XML.md +1 -1
- package/skills/alloy-guides/references/WIDGETS.md +1 -1
- package/skills/alloy-howtos/SKILL.md +27 -27
- package/skills/alloy-howtos/references/best_practices.md +9 -9
- package/skills/alloy-howtos/references/cli_reference.md +14 -14
- package/skills/alloy-howtos/references/config_files.md +16 -16
- package/skills/alloy-howtos/references/custom_tags.md +16 -16
- package/skills/alloy-howtos/references/debugging_troubleshooting.md +11 -15
- package/skills/alloy-howtos/references/samples.md +19 -19
- package/skills/purgetss/SKILL.md +11 -1
- package/skills/purgetss/references/animation-system.md +1 -1
- package/skills/purgetss/references/cli-commands.md +3 -3
- package/skills/purgetss/references/customization-deep-dive.md +1 -1
- package/skills/purgetss/references/dynamic-component-creation.md +1 -1
- package/skills/purgetss/references/icon-fonts.md +4 -0
- package/skills/purgetss/references/installation-setup.md +8 -1
- package/skills/purgetss/references/migration-guide.md +4 -0
- package/skills/purgetss/references/tikit-components.md +193 -204
- package/skills/purgetss/references/ui-ux-design.md +1 -1
- package/skills/ti-expert/SKILL.md +78 -118
- package/skills/ti-expert/references/alloy-builtins.md +18 -18
- package/skills/ti-expert/references/alloy-structure.md +21 -21
- package/skills/ti-expert/references/anti-patterns.md +15 -15
- package/skills/ti-expert/references/cli-expert.md +15 -15
- package/skills/ti-expert/references/code-conventions.md +38 -38
- package/skills/ti-expert/references/contracts.md +8 -8
- package/skills/ti-expert/references/controller-patterns.md +14 -14
- package/skills/ti-expert/references/error-handling.md +11 -11
- package/skills/ti-expert/references/examples.md +12 -12
- package/skills/ti-expert/references/migration-patterns.md +24 -24
- package/skills/ti-expert/references/patterns.md +10 -10
- package/skills/ti-expert/references/performance-listview.md +16 -16
- package/skills/ti-expert/references/performance-optimization.md +41 -41
- package/skills/ti-expert/references/security-device.md +22 -22
- package/skills/ti-expert/references/security-fundamentals.md +19 -19
- package/skills/ti-expert/references/state-management.md +33 -33
- package/skills/ti-expert/references/testing-e2e-ci.md +25 -25
- package/skills/ti-expert/references/testing-unit.md +24 -24
- package/skills/ti-expert/references/theming.md +15 -15
- package/skills/ti-guides/SKILL.md +58 -60
- package/skills/ti-guides/references/advanced-data-and-images.md +33 -33
- package/skills/ti-guides/references/android-manifest.md +15 -15
- package/skills/ti-guides/references/app-distribution.md +70 -166
- package/skills/ti-guides/references/application-frameworks.md +96 -114
- package/skills/ti-guides/references/cli-reference.md +294 -294
- package/skills/ti-guides/references/coding-best-practices.md +42 -33
- package/skills/ti-guides/references/commonjs-advanced.md +57 -51
- package/skills/ti-guides/references/hello-world.md +36 -36
- package/skills/ti-guides/references/hyperloop-native-access.md +66 -66
- package/skills/ti-guides/references/javascript-primer.md +83 -101
- package/skills/ti-guides/references/reserved-words.md +9 -9
- package/skills/ti-guides/references/resources.md +75 -83
- package/skills/ti-guides/references/style-and-conventions.md +35 -28
- package/skills/ti-guides/references/tiapp-config.md +110 -74
- package/skills/ti-howtos/SKILL.md +88 -92
- package/skills/ti-howtos/references/android-platform-deep-dives.md +104 -104
- package/skills/ti-howtos/references/automation-fastlane-appium.md +39 -39
- package/skills/ti-howtos/references/buffer-codec-streams.md +60 -60
- package/skills/ti-howtos/references/cross-platform-development.md +115 -136
- package/skills/ti-howtos/references/debugging-profiling.md +167 -181
- package/skills/ti-howtos/references/extending-titanium.md +121 -121
- package/skills/ti-howtos/references/google-maps-v2.md +84 -82
- package/skills/ti-howtos/references/ios-map-kit.md +65 -60
- package/skills/ti-howtos/references/ios-platform-deep-dives.md +123 -123
- package/skills/ti-howtos/references/local-data-sources.md +79 -78
- package/skills/ti-howtos/references/location-and-maps.md +116 -120
- package/skills/ti-howtos/references/media-apis.md +87 -86
- package/skills/ti-howtos/references/notification-services.md +250 -260
- package/skills/ti-howtos/references/remote-data-sources.md +98 -93
- package/skills/ti-howtos/references/tutorials.md +226 -216
- package/skills/ti-howtos/references/using-modules.md +73 -102
- package/skills/ti-howtos/references/web-content-integration.md +101 -103
- package/skills/ti-howtos/references/webpack-build-pipeline.md +52 -44
- package/skills/ti-ui/SKILL.md +85 -85
- package/skills/ti-ui/references/accessibility-deep-dive.md +57 -57
- package/skills/ti-ui/references/animation-and-matrices.md +79 -79
- package/skills/ti-ui/references/application-structures.md +96 -99
- package/skills/ti-ui/references/custom-fonts-styling.md +99 -99
- package/skills/ti-ui/references/event-handling.md +58 -58
- package/skills/ti-ui/references/gestures.md +62 -64
- package/skills/ti-ui/references/icons-and-splash-screens.md +88 -88
- package/skills/ti-ui/references/layouts-and-positioning.md +87 -97
- package/skills/ti-ui/references/listviews-and-performance.md +107 -107
- package/skills/ti-ui/references/orientation.md +87 -88
- package/skills/ti-ui/references/platform-ui-android.md +87 -81
- package/skills/ti-ui/references/platform-ui-ios.md +63 -61
- package/skills/ti-ui/references/scrolling-views.md +29 -29
- package/skills/ti-ui/references/tableviews.md +56 -56
|
@@ -1,30 +1,32 @@
|
|
|
1
1
|
# Google Maps v2 for Android
|
|
2
2
|
|
|
3
|
-
Guide
|
|
3
|
+
Guide to implementing native maps on Android using the `ti.map` module (v2).
|
|
4
4
|
|
|
5
|
-
## 1. Initial
|
|
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
|
|
16
|
-
1. Create a project in the
|
|
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
|
|
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 (
|
|
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
|
-
|
|
25
|
+
Default password: empty (press Enter).
|
|
25
26
|
|
|
26
27
|
### Configure tiapp.xml
|
|
27
|
-
Add the API
|
|
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
|
|
40
|
+
## 2. Google Play Services verification
|
|
39
41
|
|
|
40
|
-
|
|
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
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
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
|
|
67
|
+
## 3. Using the map view
|
|
66
68
|
|
|
67
|
-
### Basic
|
|
69
|
+
### Basic creation
|
|
68
70
|
```javascript
|
|
69
71
|
const MapModule = require('ti.map');
|
|
70
72
|
const mapView = MapModule.createView({
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
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
|
|
85
|
-
- `MapModule.NORMAL_TYPE`:
|
|
86
|
-
- `MapModule.SATELLITE_TYPE`:
|
|
87
|
-
- `MapModule.TERRAIN_TYPE`:
|
|
88
|
-
- `MapModule.HYBRID_TYPE`:
|
|
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
|
|
92
|
+
## 4. Advanced annotations (pins)
|
|
91
93
|
|
|
92
94
|
```javascript
|
|
93
95
|
const opera = MapModule.createAnnotation({
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
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
|
|
109
|
-
- `customView
|
|
110
|
-
- `centerOffset
|
|
111
|
-
- `canShowCallout
|
|
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
|
-
|
|
115
|
+
Precedence: `customView` > `image` > default pin. For buttons: `leftView`/`rightView` take precedence over `leftButton`/`rightButton`.
|
|
114
116
|
|
|
115
|
-
### Available
|
|
117
|
+
### Available pin colors
|
|
116
118
|
`ANNOTATION_AZURE`, `BLUE`, `CYAN`, `GREEN`, `MAGENTA`, `ORANGE`, `RED`, `ROSE`, `VIOLET`, `YELLOW`.
|
|
117
119
|
|
|
118
|
-
## 5. Routes (
|
|
120
|
+
## 5. Routes (polylines)
|
|
119
121
|
|
|
120
122
|
```javascript
|
|
121
123
|
const route = MapModule.createRoute({
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
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
|
|
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
|
-
|
|
139
|
-
|
|
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
|
-
|
|
146
|
-
|
|
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
|
-
|
|
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
|
-
|
|
161
|
+
Ti.API.info('Map loaded');
|
|
160
162
|
});
|
|
161
163
|
```
|
|
162
164
|
|
|
163
|
-
## 7. Migration from
|
|
165
|
+
## 7. Migration from legacy Titanium.Map
|
|
164
166
|
|
|
165
|
-
|
|
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
|
|
168
|
-
-
|
|
169
|
-
-
|
|
170
|
-
-
|
|
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
|
|
3
|
+
Guide to implementing native maps on iOS with the `ti.map` module.
|
|
4
4
|
|
|
5
|
-
## 1. Initial
|
|
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
|
|
16
|
-
Add the
|
|
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
|
-
|
|
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
|
|
34
|
+
## 2. Using the map view
|
|
33
35
|
|
|
34
|
-
### Basic
|
|
36
|
+
### Basic creation
|
|
35
37
|
```javascript
|
|
36
38
|
const MapModule = require('ti.map');
|
|
37
39
|
const mapView = MapModule.createView({
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
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
|
|
52
|
+
## 3. 3D camera (perspective)
|
|
51
53
|
|
|
52
|
-
iOS
|
|
54
|
+
iOS lets you tilt and rotate the map for 3D views.
|
|
53
55
|
|
|
54
|
-
|
|
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
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
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
|
-
|
|
67
|
-
|
|
68
|
-
|
|
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
|
|
75
|
+
mapView.showsBuildings = true; // 3D buildings
|
|
74
76
|
```
|
|
75
77
|
|
|
76
|
-
## 4. iOS
|
|
78
|
+
## 4. iOS annotations
|
|
77
79
|
|
|
78
|
-
### System
|
|
79
|
-
iOS allows
|
|
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
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
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
|
|
98
|
-
If
|
|
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
|
-
|
|
102
|
-
|
|
104
|
+
image: 'flag.png',
|
|
105
|
+
centerOffset: { x: 10, y: -20 } // Visually moves the pin
|
|
103
106
|
});
|
|
104
107
|
```
|
|
105
108
|
|
|
106
|
-
## 5. Advanced
|
|
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
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
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
|
-
|
|
128
|
-
|
|
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
|
-
|
|
134
|
-
|
|
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
|
```
|