Skip to content
This repository has been archived by the owner on Mar 8, 2023. It is now read-only.

Update-able TextStyleCache #2017

Merged
merged 3 commits into from
Jan 7, 2021
Merged

Update-able TextStyleCache #2017

merged 3 commits into from
Jan 7, 2021

Conversation

FraukeF
Copy link
Contributor

@FraukeF FraukeF commented Dec 16, 2020

Thank you for contributing to harp.gl!

Before requesting a pull request, please remember to check the following documents:

If you are adding new functionality we would highly appreciate if you can describe what is the capability you are adding and even better if you can add some examples. Please also remember to add tests for it.

CI Check

Our bots will check whether your PR can be directly integrated into the mainline. We have some internal integration tests running on the background, our bots will inform you of the next steps and someone from our team will take a look and help if needed!

And please do not forget to sign-off your commit! You can read more about DCO here. But, in short, you just need to use git commit -s or append --signoff when you are committing to the repo.

Happy contributing!

@codecov
Copy link

codecov bot commented Dec 16, 2020

Codecov Report

Merging #2017 (f421ef5) into master (2c4ebb6) will increase coverage by 0.14%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2017      +/-   ##
==========================================
+ Coverage   66.41%   66.56%   +0.14%     
==========================================
  Files         297      297              
  Lines       26337    26338       +1     
  Branches     5939     5941       +2     
==========================================
+ Hits        17493    17531      +38     
+ Misses       8844     8807      -37     
Impacted Files Coverage Δ
...here/harp-mapview/lib/text/TextElementsRenderer.ts 71.94% <100.00%> (-0.04%) ⬇️
@here/harp-mapview/lib/text/TextStyleCache.ts 68.83% <100.00%> (+15.55%) ⬆️
@here/harp-utils/lib/Logger/ConsoleChannel.ts 38.46% <0.00%> (+15.38%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2c4ebb6...f421ef5. Read the comment docs.

@FraukeF
Copy link
Contributor Author

FraukeF commented Jan 5, 2021

@harpgl-bot retest this please

Copy link
Collaborator

@atomicsulfate atomicsulfate left a comment

Choose a reason for hiding this comment

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

Just a minor comment.

Comment on lines 99 to 115
textStyleDefinitions?.forEach(element => {
this.m_textStyles.set(
element.name!,
this.createTextElementStyle(element, element.name!)
);
});

// Remove obsolete
for (const [name] of this.m_textStyles) {
if (
textStyleDefinitions.findIndex(definition => {
return definition.name === name;
}) === -1
) {
this.m_textStyles.delete(name);
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
textStyleDefinitions?.forEach(element => {
this.m_textStyles.set(
element.name!,
this.createTextElementStyle(element, element.name!)
);
});
// Remove obsolete
for (const [name] of this.m_textStyles) {
if (
textStyleDefinitions.findIndex(definition => {
return definition.name === name;
}) === -1
) {
this.m_textStyles.delete(name);
}
}
this.m_textStyles.clear();
textStyleDefinitions.forEach(element => {
this.m_textStyles.set(
element.name!,
this.createTextElementStyle(element, element.name!)
);
});

Copy link
Collaborator

Choose a reason for hiding this comment

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

  • textStyleDefinitions is always defined in the else branch of the condition statement.
  • Why not just clearing the text styles map before adding the new ones. Since we're overwriting with the new text styles, it should be the same.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

Frauke Fritz added 3 commits January 7, 2021 07:02
Signed-off-by: Frauke Fritz <frauke.fritz@here.com>
Signed-off-by: Frauke Fritz <frauke.fritz@here.com>
Signed-off-by: Frauke Fritz <frauke.fritz@here.com>
@FraukeF
Copy link
Contributor Author

FraukeF commented Jan 7, 2021

retest this please

@FraukeF
Copy link
Contributor Author

FraukeF commented Jan 7, 2021

retest this please

@atomicsulfate atomicsulfate self-requested a review January 7, 2021 10:28
@FraukeF FraukeF merged commit 075bf23 into master Jan 7, 2021
@FraukeF FraukeF deleted the updateable-textstylecache branch January 7, 2021 10:33
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants