Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ios): polyline click should only fire on line segments and support 2 points #476

Merged
merged 2 commits into from Aug 31, 2021

Conversation

jquick-axway
Copy link
Contributor

@jquick-axway jquick-axway commented Aug 28, 2021

JIRA:
https://jira.appcelerator.org/browse/TIMOB-28527

Summary:

  • Refactored polyline click handling to only work on line segments like Android.
    • Used to turn polyline into a shape to determine touch points, causing empty areas to wrongly fire clicks.
  • Fixed polyline to support click events if it only has 2 points. (Used to require at least 3 points.)

Test:

  1. Build and run the below on iOS.
  2. Tap on the line and verify a dialog appears. (Verifies 2 point polyline fix.)
  3. Uncomment the 3 lines of code below and re-rerun on iOS.
  4. Verify tapping on the different line segments show a dialog.
const Map = require('ti.map');
const win = Ti.UI.createWindow();
const polyline1 = Map.createPolyline({
	points: [
		{ latitude: -33.884717, longitude: 151.187993 },  // Sydney
//		{ latitude: -33.882152, longitude: 151.203099 },  // Sydney
		{ latitude: -33.886783, longitude: 151.218033 },  // Sydney
//		{ latitude: 37.7749, longitude: -122.4194 },  // San Francisco
//		{ latitude: 51.5074, longitude: 0.1278 },  // London
	],
	strokeColor: '#FF0000',
	strokeWidth: 4
});
const map = Map.createView({
	region: {
		latitude: -33.87365,
		longitude: 151.20689,
		latitudeDelta: 0.05,
		longitudeDelta: 0.05
	}
});
map.addPolyline(polyline1);
map.addEventListener('click', function(e) {
	let message = 'Click event data:\n';
	message += `- e.clicksource: ${e.clicksource}\n`;
	message += `- e.latitude: ${e.latitude}\n`;
	message += `- e.longitude: ${e.longitude}\n`;
	alert(message);
});
win.add(map);
win.open();

@jquick-axway jquick-axway changed the title fix(ios): polyline click should only work on line and with 2 points fix(ios): polyline click should only fire on line segments and support 2 points Aug 28, 2021
@build
Copy link

build commented Aug 30, 2021

Messages
📖

✅ All tests are passing
Nice one! All 292 tests are passing.
(There are 2 skipped tests not included in that total)

📖

💾 Here are the artifacts produced:

Generated by 🚫 dangerJS against e930903

@jquick-axway jquick-axway merged commit c8f5e05 into tidev:master Aug 31, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants