MCPcopy Create free account
hub / github.com/cocos/cocos-engine / _parsePointsString

Method _parsePointsString

cocos/tiledmap/tmx-xml-parser.ts:1021–1034  ·  view source on GitHub ↗
(pointsString?: string)

Source from the content-addressed store, hash-verified

1019 }
1020
1021 protected _parsePointsString (pointsString?: string): {
1022 x: number;
1023 y: number;
1024 }[] | null {
1025 if (!pointsString) return null;
1026
1027 const points: { x: number, y: number }[] = [];
1028 const pointsStr = pointsString.split(' ');
1029 for (let i = 0; i < pointsStr.length; i++) {
1030 const selPointStr = pointsStr[i].split(',');
1031 points.push({ x: parseFloat(selPointStr[0]), y: parseFloat(selPointStr[1]) });
1032 }
1033 return points;
1034 }
1035
1036 /**
1037 * Sets the tile animations.

Callers 1

_parseObjectGroupMethod · 0.95

Calls 3

parseFloatFunction · 0.85
splitMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected