fix: 修复 .logo-text 样式冲突问题#2839
Conversation
将 .logo-text 选择器限定在特定的容器 class 内 避免影响用户自定义的 .logo-text 元素 fix #2838
|
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! 此 PR 旨在修复地图 logo 样式冲突问题。原有的全局 Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
| .tencent-map--hide-logo img[src*='//mapapi.qq.com/web/jsapi/logo/logo_def.png'], | ||
| .tencent-map--hide-logo .logo-text { |
There was a problem hiding this comment.
这里的类名 .tencent-map--hide-logo 与 packages/maps/src/tmap/map.ts 中 hideLogo 方法实际添加的类名 tmap-contianer--hide-logo 不一致。这会导致隐藏 logo 的功能失效。
tmap-contianer--hide-logo 中还存在拼写错误 (contianer 应为 container)。
为了修复这个 bug 并提高代码一致性,建议将 TypeScript 文件中使用的类名统一为 tencent-map--hide-logo,因为它能更清晰地表达其用于腾讯地图的意图。
请在 packages/maps/src/tmap/map.ts 中做出如下修改:
// packages/maps/src/tmap/map.ts:507
DOM.addClass(container, 'tencent-map--hide-logo');| .tmap-contianer--hide-logo img[src*='//mapapi.qq.com/web/jsapi/logo/logo_def.png'], | ||
| .tmap-contianer--hide-logo .logo-text { |
There was a problem hiding this comment.
这个类名 tmap-contianer--hide-logo 中存在一个拼写错误,contianer 应该为 container。
另外,这个 CSS 文件是用于 Google Map (gmap) 的,但类名以 tmap 开头,并且 img 选择器 img[src*='//mapapi.qq.com/web/jsapi/logo/logo_def.png'] 针对的是腾讯地图的 logo。这看起来是错误的。
建议进行以下修改:
- 使用更合适的类名
gmap-container--hide-logo。 - 移除针对腾讯地图 logo 的
img选择器,因为它不适用于 Google Map。
这样可以使代码更清晰且正确。请记得在 packages/maps/src/gmap/map.ts 中也同步更新类名。
.gmap-container--hide-logo .logo-text {| .tencent-map--hide-logo img[src*='//mapapi.qq.com/web/jsapi/logo/logo_def.png'], | ||
| .tencent-map--hide-logo .logo-text { |
There was a problem hiding this comment.
这个 CSS 文件是用于天地图 (tdtmap) 的,但 img 选择器 img[src*='//mapapi.qq.com/web/jsapi/logo/logo_def.png'] 针对的是腾讯地图的 logo,这似乎不正确。
建议移除这个不相关的 img 选择器。另外,为了与 tmap 区分,建议使用更具体的类名,例如 tdtmap-container--hide-logo。
由于 tdtmap/map.ts 中尚未实现 hideLogo 功能,这个 CSS 当前不会生效,但进行以上修改可以让未来的实现更清晰。
.tdtmap-container--hide-logo .logo-text {
描述
修复 Issue #2838: L7 的
.logo-text样式使用!important覆盖了用户自定义的同名样式问题原因
原有的 CSS 使用了通用的
.logo-text选择器,当用户在自己的代码中也定义.logo-text时,会被 L7 的display: none !important规则覆盖。修复内容
将
.logo-text选择器限定在特定的容器 class 内(.tmap-contianer--hide-logo),确保只在 L7 的地图容器内隐藏 logo 文本,不影响用户的自定义样式。代码变更
packages/maps/src/gmap/logo.css: 使用.tmap-contianer--hide-logo .logo-textpackages/maps/src/tdtmap/logo.css: 使用.tencent-map--hide-logo .logo-textpackages/maps/src/tmap/logo.css: 使用.tencent-map--hide-logo .logo-text✅ 解决了 Issue #2838