Skip to content

Commit

Permalink
fix issue 19830
Browse files Browse the repository at this point in the history
  • Loading branch information
DoreenHu committed Apr 25, 2024
1 parent c439fa6 commit a207c9f
Showing 1 changed file with 25 additions and 10 deletions.
35 changes: 25 additions & 10 deletions src/coord/CoordinateSystem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,8 @@ export interface CoordinateSystem {

getRoamTransform?: () => MatrixArray;

fixSurfaceBug?: (data: ScaleDataValue[][]) => void;
fixSurfaceBug?: (data: ScaleDataValue[][]) => ScaleDataValue[][];
}

getArea?: (tolerance?: number) => CoordinateSystemClipArea

Expand All @@ -168,15 +169,29 @@ export interface CoordinateSystem {
* Like GridModel, PolarModel, ...
*/
class SomeCoordinateSystemImplementation implements CoordinateSystem {
fixSurfaceBug(data: ScaleDataValue[][]): void {
if (data.length > 5) {
console.log('fix');
}
/
fixSurfaceBug(data: ScaleDataValue[][]): ScaleDataValue[][] {
let fixedData = data.map(subArray =>
subArray.length > 5 ? subArray.slice(0, 5) : subArray
);


const expectedLength = 5;
fixedData = fixedData.map(subArray => {
if (subArray.length > expectedLength) {
return subArray.slice(0, expectedLength);
}
while (subArray.length < expectedLength) {
subArray.push(subArray[subArray.length - 1]);
}
return subArray;
});

console.log('fix');

return fixedData;
}

// ... 省略其他属性和方法的实现 ...
}


export interface CoordinateSystemHostModel extends ComponentModel {
coordinateSystem?: CoordinateSystemMaster
}
Expand All @@ -193,4 +208,4 @@ export function isCoordinateSystemType<T extends CoordinateSystem, S = T['type']
coordSys: CoordinateSystem, type: S
): coordSys is T {
return (coordSys.type as unknown as S) === type;
}
}

0 comments on commit a207c9f

Please sign in to comment.