Skip to content

feat: add updatePointProperties()#3

Merged
sanDer153 merged 2 commits into
mainfrom
sander/update-point-properties
Aug 19, 2025
Merged

feat: add updatePointProperties()#3
sanDer153 merged 2 commits into
mainfrom
sander/update-point-properties

Conversation

@sanDer153
Copy link
Copy Markdown
Member

This PR adds the first new method in the mutable supercluster. This method allows you to update a point to a given point. This method only takes effect when the id of the provided point corresponds to a point-id in the cluster, and the updated point has the same location.

Copy link
Copy Markdown

@Max-Verbinnen Max-Verbinnen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice, i like the design of the new method :)

Comment thread index.js Outdated
}

updatePointProperties(point) {
const id = this._linearSearchInPoints(point);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

iiuc, this should be idx instead of id

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done 👍

Comment thread index.js Outdated

updatePointProperties(point) {
const id = this._linearSearchInPoints(point);
if (!id) return;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe we should also throw an error in this case?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done 👍

Comment thread index.js Outdated
Comment on lines +426 to +432
const pointId = this.getId(point);
for (let i = 0; i < this.points.length; i++) {
if (this.getId(this.points[i]) === pointId) {
return i;
}
}
return null;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const pointId = this.getId(point);
for (let i = 0; i < this.points.length; i++) {
if (this.getId(this.points[i]) === pointId) {
return i;
}
}
return null;
const pointId = this.getId(point);
const index = this.points.findIndex(p => this.getId(p) === pointId);
return index !== -1 ? index : null;

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done 👍

@sanDer153 sanDer153 merged commit a244131 into main Aug 19, 2025
2 checks passed
@sanDer153 sanDer153 deleted the sander/update-point-properties branch August 19, 2025 15:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants