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

(MapChart) Why don't the wheelSensitivity and wheelDuration properties work when wheelY is set to zoom? #1398

Closed
suu3 opened this issue Mar 12, 2024 · 4 comments
Labels

Comments

@suu3
Copy link

suu3 commented Mar 12, 2024

Question

I tried to apply the wheelSensitivity and wheelDuration properties to the MapChart, but it seemed to have no effect. Then, I found the following code in the amcharts5 repository.

amcharts5/src/.internal/charts/map/MapChart.ts 346-382

...
	this._wheelDp = chartContainer.events.on("wheel", (event) => {
	const wheelEasing = this.get("wheelEasing")!;
	const wheelSensitivity = this.get("wheelSensitivity", 1);
	const wheelDuration = this.get("wheelDuration", 0);

	const wheelEvent = event.originalEvent;

	// Ignore wheel event if it is happening on a non-chart element, e.g. if
	// some page element is over the chart.
	if ($utils.isLocalEvent(wheelEvent, this)) {
		wheelEvent.preventDefault();
	}
	else {
		return;
	}

	const point = chartContainer._display.toLocal(event.point);

	if ((wheelY == "zoom")) {
		this._handleWheelZoom(wheelEvent.deltaY, point);
	}
	else if (wheelY == "rotateY") {
		this._handleWheelRotateY(wheelEvent.deltaY / 5 * wheelSensitivity, wheelDuration, wheelEasing);
	}
	else if (wheelY == "rotateX") {
		this._handleWheelRotateX(wheelEvent.deltaY / 5 * wheelSensitivity, wheelDuration, wheelEasing);
	}

	if ((wheelX == "zoom")) {
		this._handleWheelZoom(wheelEvent.deltaX, point);
	}
	else if (wheelX == "rotateY") {
		this._handleWheelRotateY(wheelEvent.deltaX / 5 * wheelSensitivity, wheelDuration, wheelEasing);
	}
	else if (wheelX == "rotateX") {
		this._handleWheelRotateX(wheelEvent.deltaX / 5 * wheelSensitivity, wheelDuration, wheelEasing);
	}
...

I'm curious why wheelSensitivity and wheelDuration properties are missing only when wheelY is set to "zoom".

@zeroin zeroin added the bug Something isn't working label Mar 12, 2024
@zeroin
Copy link
Collaborator

zeroin commented Mar 12, 2024

Indeed, we will investigate and will let you know. Thank you for noticing.

@zeroin
Copy link
Collaborator

zeroin commented Mar 12, 2024

Although I think we decided that it should use zoomStep value, but still, we'll discuss it internally.

@suu3
Copy link
Author

suu3 commented Mar 12, 2024

Thank you. I will use zoomStep.
In my opinion, it would be better if the documentation explicitly stated that wheelSensitivity and wheelDuration cannot be used when wheelY is set to "zoom", or if the same action is performed regardless of the value of wheelY.

@martynasma
Copy link
Collaborator

@suu3 We're updating docs as we speak. Thanks for the suggestion!

@martynasma martynasma added question and removed bug Something isn't working labels Mar 15, 2024
@suu3 suu3 closed this as completed Mar 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants