Commit 6120794192ccf6a4eba5ad1fa4bb00703b9c7bd6
1 parent
f31399f2
其他公交公司用的公交电子站牌页面组件
1、修正在android游览器下的兼容性问题,主要是修正tspan使用getExtentOfChar(0).height获取高度,而不是使用getBBox().height
Showing
2 changed files
with
49 additions
and
50 deletions
front-end/h5/src/components/core/plugins/bsth/othergj/linechart/chart/othergj-eBusStop-line-chart.js
| ... | ... | @@ -259,7 +259,6 @@ export default { |
| 259 | 259 | <stop offset="100%" stop-color={this.chart_line_gradient_color_start} /> |
| 260 | 260 | </linearGradient> |
| 261 | 261 | </defs> |
| 262 | - s | |
| 263 | 262 | <g class="lineRouteGpsInfo" transform={ "translate(" + this.left_part_width + ",0)" }> |
| 264 | 263 | <g class="line-wrap"></g> |
| 265 | 264 | <g class="gps-wrap"></g> |
| ... | ... | @@ -1589,8 +1588,8 @@ export default { |
| 1589 | 1588 | .style('fill', self.left_part_info_left_font_color) |
| 1590 | 1589 | .attr('x', 0) |
| 1591 | 1590 | .attr('dy', function () { |
| 1592 | - let tspan_box = d3.select(this.parentNode).select('tspan.lineName').node().getBBox() | |
| 1593 | - return tspan_box.height + 2 | |
| 1591 | + let tspan_box_height = d3.select(this.parentNode).select('tspan.lineName').node().getExtentOfChar(0).height | |
| 1592 | + return tspan_box_height + 2 | |
| 1594 | 1593 | }) |
| 1595 | 1594 | textItemsEnter.select('text').append('tspan') |
| 1596 | 1595 | .classed('endStop_right', true) |
| ... | ... | @@ -1604,8 +1603,8 @@ export default { |
| 1604 | 1603 | .style('font-size', self.left_part_info_left_font_size) |
| 1605 | 1604 | .style('fill', self.left_part_info_left_font_color) |
| 1606 | 1605 | .attr('dy', function () { |
| 1607 | - let tspan_box = d3.select(this.parentNode).select('tspan.lineName').node().getBBox() | |
| 1608 | - return tspan_box.height + 2 | |
| 1606 | + let tspan_box_height = d3.select(this.parentNode).select('tspan.lineName').node().getExtentOfChar(0).height | |
| 1607 | + return tspan_box_height + 2 | |
| 1609 | 1608 | }) |
| 1610 | 1609 | textItemsUpdate.select('tspan.endStop_right') |
| 1611 | 1610 | .style('font-size', self.left_part_end_stop_font_size) |
| ... | ... | @@ -1619,12 +1618,12 @@ export default { |
| 1619 | 1618 | .style('fill', self.left_part_info_left_font_color) |
| 1620 | 1619 | .attr('x', 0) |
| 1621 | 1620 | .attr('dy', function () { |
| 1622 | - let tspan_box_left = d3.select(this.parentNode).select('tspan.endStop_left').node().getBBox() | |
| 1623 | - let tspan_box_right = d3.select(this.parentNode).select('tspan.endStop_right').node().getBBox() | |
| 1624 | - if (tspan_box_left.height > tspan_box_right.height) { | |
| 1625 | - return tspan_box_left.height + 2 | |
| 1621 | + let tspan_box_left_height = d3.select(this.parentNode).select('tspan.endStop_left').node().getExtentOfChar(0).height | |
| 1622 | + let tspan_box_right_height = d3.select(this.parentNode).select('tspan.endStop_right').node().getExtentOfChar(0).height | |
| 1623 | + if (tspan_box_left_height > tspan_box_right_height) { | |
| 1624 | + return tspan_box_left_height + 2 | |
| 1626 | 1625 | } else { |
| 1627 | - return tspan_box_right.height + 2 | |
| 1626 | + return tspan_box_right_height + 2 | |
| 1628 | 1627 | } |
| 1629 | 1628 | }) |
| 1630 | 1629 | textItemsEnter.select('text').append('tspan') |
| ... | ... | @@ -1639,12 +1638,12 @@ export default { |
| 1639 | 1638 | .style('font-size', self.left_part_info_left_font_size) |
| 1640 | 1639 | .style('fill', self.left_part_info_left_font_color) |
| 1641 | 1640 | .attr('dy', function () { |
| 1642 | - let tspan_box_left = d3.select(this.parentNode).select('tspan.endStop_left').node().getBBox() | |
| 1643 | - let tspan_box_right = d3.select(this.parentNode).select('tspan.endStop_right').node().getBBox() | |
| 1644 | - if (tspan_box_left.height > tspan_box_right.height) { | |
| 1645 | - return tspan_box_left.height + 2 | |
| 1641 | + let tspan_box_left_height = d3.select(this.parentNode).select('tspan.endStop_left').node().getExtentOfChar(0).height | |
| 1642 | + let tspan_box_right_height = d3.select(this.parentNode).select('tspan.endStop_right').node().getExtentOfChar(0).height | |
| 1643 | + if (tspan_box_left_height > tspan_box_right_height) { | |
| 1644 | + return tspan_box_left_height + 2 | |
| 1646 | 1645 | } else { |
| 1647 | - return tspan_box_right.height + 2 | |
| 1646 | + return tspan_box_right_height + 2 | |
| 1648 | 1647 | } |
| 1649 | 1648 | }) |
| 1650 | 1649 | textItemsUpdate.select('tspan.arrival_right') |
| ... | ... | @@ -1662,12 +1661,12 @@ export default { |
| 1662 | 1661 | .style('fill', self.left_part_info_left_font_color) |
| 1663 | 1662 | .attr('x', 0) |
| 1664 | 1663 | .attr('dy', function () { |
| 1665 | - let tspan_box_left = d3.select(this.parentNode).select('tspan.arrival_left').node().getBBox() | |
| 1666 | - let tspan_box_right = d3.select(this.parentNode).select('tspan.arrival_right').node().getBBox() | |
| 1667 | - if (tspan_box_left.height > tspan_box_right.height) { | |
| 1668 | - return tspan_box_left.height + 2 | |
| 1664 | + let tspan_box_left_height = d3.select(this.parentNode).select('tspan.arrival_left').node().getExtentOfChar(0).height | |
| 1665 | + let tspan_box_right_height = d3.select(this.parentNode).select('tspan.arrival_right').node().getExtentOfChar(0).height | |
| 1666 | + if (tspan_box_left_height > tspan_box_right_height) { | |
| 1667 | + return tspan_box_left_height + 2 | |
| 1669 | 1668 | } else { |
| 1670 | - return tspan_box_right.height + 2 | |
| 1669 | + return tspan_box_right_height + 2 | |
| 1671 | 1670 | } |
| 1672 | 1671 | }) |
| 1673 | 1672 | textItemsEnter.select('text').append('tspan') |
| ... | ... | @@ -1682,12 +1681,12 @@ export default { |
| 1682 | 1681 | .style('font-size', self.left_part_info_left_font_size) |
| 1683 | 1682 | .style('fill', self.left_part_info_left_font_color) |
| 1684 | 1683 | .attr('dy', function () { |
| 1685 | - let tspan_box_left = d3.select(this.parentNode).select('tspan.arrival_left').node().getBBox() | |
| 1686 | - let tspan_box_right = d3.select(this.parentNode).select('tspan.arrival_right').node().getBBox() | |
| 1687 | - if (tspan_box_left.height > tspan_box_right.height) { | |
| 1688 | - return tspan_box_left.height + 2 | |
| 1684 | + let tspan_box_left_height = d3.select(this.parentNode).select('tspan.arrival_left').node().getExtentOfChar(0).height | |
| 1685 | + let tspan_box_right_height = d3.select(this.parentNode).select('tspan.arrival_right').node().getExtentOfChar(0).height | |
| 1686 | + if (tspan_box_left_height > tspan_box_right_height) { | |
| 1687 | + return tspan_box_left_height + 2 | |
| 1689 | 1688 | } else { |
| 1690 | - return tspan_box_right.height + 2 | |
| 1689 | + return tspan_box_right_height + 2 | |
| 1691 | 1690 | } |
| 1692 | 1691 | }) |
| 1693 | 1692 | textItemsUpdate.select('tspan.startEnd_right') | ... | ... |
front-end/h5/src/components/core/plugins/index.js
| ... | ... | @@ -20,8 +20,8 @@ import LbpBackground from 'core/plugins/lbp-background' |
| 20 | 20 | // import LbpTabs from 'core/components/plugins/lbp-tabs' |
| 21 | 21 | |
| 22 | 22 | /** 自定义的组件 */ |
| 23 | -// import BsthLineChart from 'core/plugins/bsth/bsth-line-chart' | |
| 24 | -// import BsthLineChartList from 'core/plugins/bsth/bsth-line-chart-list' | |
| 23 | +import BsthLineChart from 'core/plugins/bsth/bsth-line-chart' | |
| 24 | +import BsthLineChartList from 'core/plugins/bsth/bsth-line-chart-list' | |
| 25 | 25 | import BsthLineChartScrollList from 'core/plugins/bsth/bsth-line-chart-scrollList' |
| 26 | 26 | import BsthSlide from 'core/plugins/bsth/bsth-slide' |
| 27 | 27 | import BsthWeatherRealtime from 'core/plugins/bsth/bsth-weather-realtime' |
| ... | ... | @@ -396,29 +396,29 @@ export const pluginsList = [ |
| 396 | 396 | name: OthergjEBusStopLineChartList.name |
| 397 | 397 | }, |
| 398 | 398 | |
| 399 | - // { | |
| 400 | - // i18nTitle: { | |
| 401 | - // 'en-US': 'LineChart', | |
| 402 | - // 'zh-CN': '线路模拟图' | |
| 403 | - // }, | |
| 404 | - // title: '线路模拟图', | |
| 405 | - // icon: 'list', | |
| 406 | - // component: BsthLineChart, | |
| 407 | - // visible: true, | |
| 408 | - // name: BsthLineChart.name | |
| 409 | - // }, | |
| 410 | - // | |
| 411 | - // { | |
| 412 | - // i18nTitle: { | |
| 413 | - // 'en-US': 'LineChartList', | |
| 414 | - // 'zh-CN': '线路模拟图列表' | |
| 415 | - // }, | |
| 416 | - // title: '线路模拟图列表', | |
| 417 | - // icon: 'list', | |
| 418 | - // component: BsthLineChartList, | |
| 419 | - // visible: true, | |
| 420 | - // name: BsthLineChartList.name | |
| 421 | - // }, | |
| 399 | + { | |
| 400 | + i18nTitle: { | |
| 401 | + 'en-US': 'LineChart', | |
| 402 | + 'zh-CN': '线路模拟图' | |
| 403 | + }, | |
| 404 | + title: '线路模拟图', | |
| 405 | + icon: 'list', | |
| 406 | + component: BsthLineChart, | |
| 407 | + visible: false, | |
| 408 | + name: BsthLineChart.name | |
| 409 | + }, | |
| 410 | + | |
| 411 | + { | |
| 412 | + i18nTitle: { | |
| 413 | + 'en-US': 'LineChartList', | |
| 414 | + 'zh-CN': '线路模拟图列表' | |
| 415 | + }, | |
| 416 | + title: '线路模拟图列表', | |
| 417 | + icon: 'list', | |
| 418 | + component: BsthLineChartList, | |
| 419 | + visible: false, | |
| 420 | + name: BsthLineChartList.name | |
| 421 | + }, | |
| 422 | 422 | |
| 423 | 423 | { |
| 424 | 424 | i18nTitle: { | ... | ... |