Skip to content

Commit

Permalink
Version 5.9.8
Browse files Browse the repository at this point in the history
  • Loading branch information
martynasma committed May 10, 2024
1 parent 246b9db commit aa12c13
Show file tree
Hide file tree
Showing 8 changed files with 94 additions and 14 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"private": true,
"name": "@amcharts/amcharts5",
"version": "5.9.7",
"version": "5.9.8",
"author": "amCharts <contact@amcharts.com> (https://www.amcharts.com/)",
"description": "amCharts 5",
"homepage": "https://www.amcharts.com/",
Expand Down
11 changes: 11 additions & 0 deletions packages/shared/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,17 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
Please note, that this project, while following numbering syntax, it DOES NOT
adhere to [Semantic Versioning](http://semver.org/spec/v2.0.0.html) rules.

## [5.9.8] - 2024-05-10

### Added
- Two new settings for `Sprite` added: `ariaCurrent` (sets [`aria-current`](https://w3c.github.io/aria/#aria-current)) and `ariaSelected` (sets [`aria-selected`](https://w3c.github.io/aria/#aria-selected)).
- Two new methods for `MapPolygonSeries` added: `getPolygonByPoint()` and `getPolygonByGeoPoint()`.

### Fixed
- Better positioning of `EditableLabel` when its `width` is set.
- `alwaysShow` setting of `XYCursor` was not working properly.


## [5.9.7] - 2024-05-07

### Fixed
Expand Down
29 changes: 28 additions & 1 deletion src/.internal/charts/map/MapPolygonSeries.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import type { DataItem } from "../../core/render/Component";
import type { Animation } from "../../core/util/Entity";
import type { IPoint } from "../../core/util/IPoint";
import type { IGeoPoint } from "../../core/util/IGeoPoint";

import { MapSeries, IMapSeriesSettings, IMapSeriesDataItem, IMapSeriesPrivate } from "./MapSeries";
import { MapPolygon } from "./MapPolygon";
Expand Down Expand Up @@ -295,4 +297,29 @@ export class MapPolygonSeries extends MapSeries {
}
}
}
}

/**
* Returns a [[MapPolygon]] that is under specific X/Y point.
*
* @since 5.9.8
* @param point X/Y
* @return Polygon
*/
public getPolygonByPoint(point: IPoint): MapPolygon | undefined {
let found: MapPolygon | undefined;
const renderer = this._display._renderer;
const displayObject = (renderer as any).getObjectAtPoint(point);
if (displayObject) {
this.mapPolygons.each(function(polygon) {
if (polygon._display == displayObject) {
found = polygon;
}
});
return found;
}
}

public getPolygonByGeoPoint(point: IGeoPoint): MapPolygon | undefined {
return this.getPolygonByPoint(this.chart!.convert(point));
}
}
19 changes: 12 additions & 7 deletions src/.internal/charts/xy/XYCursor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,8 @@ export class XYCursor extends Container {
declare public _privateSettings: IXYCursorPrivate;
declare public _events: IXYCursorEvents;

protected _alwaysShow: boolean = false;

/**
* A [[Grid]] elment that used for horizontal line of the cursor crosshair.
*
Expand Down Expand Up @@ -366,6 +368,7 @@ export class XYCursor extends Container {
}

protected _handleLineFocus() {
this._alwaysShow = this.get("alwaysShow", false);
this.setAll({
positionX: this.getPrivate("positionX", 0),
positionY: this.getPrivate("positionY", 0),
Expand All @@ -376,11 +379,13 @@ export class XYCursor extends Container {
}

protected _handleLineBlur() {
this.setAll({
positionX: undefined,
positionY: undefined,
alwaysShow: false
});
if (this.lineX.isFocus() || this.lineY.isFocus()) {
this.setAll({
positionX: undefined,
positionY: undefined,
alwaysShow: this._alwaysShow
});
}
}

public _prepareChildren() {
Expand Down Expand Up @@ -533,8 +538,8 @@ export class XYCursor extends Container {
}
}
this._handleMove(event);
if(Math.hypot(this._lastPoint2.x - event.point.x, this._lastPoint2.y - event.point.y) > 1) {

if (Math.hypot(this._lastPoint2.x - event.point.x, this._lastPoint2.y - event.point.y) > 1) {
this._handleLineBlur();
this._lastPoint2 = event.point;
}
Expand Down
2 changes: 1 addition & 1 deletion src/.internal/core/Registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export class Registry {
/**
* Currently running version of amCharts.
*/
readonly version: string = "5.9.7";
readonly version: string = "5.9.8";

/**
* List of applied licenses.
Expand Down
16 changes: 16 additions & 0 deletions src/.internal/core/Root.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1482,6 +1482,22 @@ export class Root implements IDisposer {
focusElement.removeAttribute("aria-checked");
}

const ariaCurrent = target.get("ariaCurrent");
if (ariaCurrent != null) {
focusElement.setAttribute("aria-current", ariaCurrent);
}
else {
focusElement.removeAttribute("aria-current");
}

const ariaSelected = target.get("ariaSelected");
if (ariaSelected != null && role && ["gridcell", "option", "row", "tab", "columnheader", "rowheader", "treeitem"].indexOf(role) !== -1) {
focusElement.setAttribute("aria-selected", ariaSelected ? "true" : "false");
}
else {
focusElement.removeAttribute("aria-selected");
}

if (target.get("ariaHidden")) {
focusElement.setAttribute("aria-hidden", "true");
}
Expand Down
13 changes: 9 additions & 4 deletions src/.internal/core/render/EditableLabel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,6 @@ export class EditableLabel extends Label {
// @todo

// Size
// Handle maxWidth
textarea.style.overflow = "hidden";
const maxWidth = this.get("maxWidth", 0) - this.get("paddingLeft", 0) - this.get("paddingRight", 0);
if (maxWidth > 0) {
Expand All @@ -258,6 +257,12 @@ export class EditableLabel extends Label {
textarea.style.height = "auto";
textarea.style.minHeight = textarea.scrollHeight + "px";

// If width is explicitly set on a label, use it for textarea
if (this.get("width")) {
textarea.style.width = (this.width() - this.get("paddingLeft", 0) - this.get("paddingRight", 0)) + "px";
textarea.style.minWidth = "";
}

// Line height
const lineHeight = this.get("lineHeight");
if (!lineHeight) {
Expand Down Expand Up @@ -320,14 +325,14 @@ export class EditableLabel extends Label {
const textAlign = this.get("textAlign", "start");
if (textAlign == "center") {
textarea.style.textAlign = "center";
if (!el.style.transform.match(/translateX/)) {
if (!el.style.transform.match(/translateX/) && !this.get("width")) {
el.style.transform += " translateX(-50%)";
}
}
else if (textAlign == "end") {
textarea.style.textAlign = "right";
if (!el.style.transform.match(/translateX/)) {
el.style.transform += "translateX(-100%)";
if (!el.style.transform.match(/translateX/) && !this.get("width")) {
el.style.transform += " translateX(-100%)";
}
}
else {
Expand Down
16 changes: 16 additions & 0 deletions src/.internal/core/util/Accessibility.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,22 @@ export interface IAccessibilitySettings {
*/
ariaChecked?: boolean;

/**
* `aria-current` setting.
*
* @see {@link https://w3c.github.io/aria/#aria-current} for more info
* @since 5.9.8
*/
ariaCurrent?: string;

/**
* `aria-selected` setting.
*
* @see {@link https://w3c.github.io/aria/#aria-selected} for more info
* @since 5.9.8
*/
ariaSelected?: boolean;

/**
* `aria-hidden` setting.
*/
Expand Down

0 comments on commit aa12c13

Please sign in to comment.