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

feat: very minimal experimental conditional style rules #1776

Merged
merged 14 commits into from
Jun 14, 2024

Conversation

yohanboniface
Copy link
Member

image

@yohanboniface yohanboniface force-pushed the conditional-rules branch 2 times, most recently from aa89dba to 6a0d842 Compare April 26, 2024 11:39
@yohanboniface
Copy link
Member Author

@Aurelie-Jallut some screens:

image

image

Copy link
Member

@almet almet left a comment

Choose a reason for hiding this comment

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

Here are just a few comments while reading the code :-) Cool, we'll have filtering rules soon :-)

umap/static/umap/js/modules/global.js Show resolved Hide resolved
umap/static/umap/js/modules/rules.js Outdated Show resolved Hide resolved

class Rule {
constructor(map, condition = '', options = {}) {
this.map = map
Copy link
Member

Choose a reason for hiding this comment

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

If these are private, should we prefix them with #?

Copy link
Member Author

Choose a reason for hiding this comment

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

Sadly, the browser support is not enough for us for this feature yet :(

umap/static/umap/js/umap.js Outdated Show resolved Hide resolved

class Rule {
constructor(map, condition = '', options = {}) {
this.map = map
Copy link
Member

Choose a reason for hiding this comment

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

I'm wondering if it would it be possible to not pass the map object here? You would need to find ways to handle isDirty and the render call in a different way, maybe with events?

Copy link
Member Author

Choose a reason for hiding this comment

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

This is a pattern we already have elsewhere in uMap, including in modules. Also I remember removing events call from the requests module (done by inheriting Leaflet Class), so I'm not exactly sure what is the pattern we'd encourage.

Anyway, I'm ok to challenge this pattern, but I'd prefer to do it in a separate PR and not to charge this one.

Copy link
Member

Choose a reason for hiding this comment

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

The goal would be to move away from having this global map superobject. I'm okay to follow the discussion elsewhere.

import * as Utils from './utils.js'
import { translate } from './i18n.js'

class Rule {
Copy link
Member

Choose a reason for hiding this comment

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

It could be useful to have a comment explaining the API for these two classes.

@yohanboniface yohanboniface force-pushed the conditional-rules branch 2 times, most recently from 25ec622 to 86c15f2 Compare May 30, 2024 17:44
@yohanboniface yohanboniface marked this pull request as ready for review June 5, 2024 09:52
@yohanboniface yohanboniface merged commit 88b7e40 into master Jun 14, 2024
3 of 4 checks passed
@yohanboniface yohanboniface deleted the conditional-rules branch June 14, 2024 16: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