Skip to content

Commit 282024d

Browse files
committed
#161 fix runin canvas for Pujiang Line
1 parent 8e1c6c5 commit 282024d

File tree

3 files changed

+44
-33
lines changed

3 files changed

+44
-33
lines changed

src/svgs/railmap/main/main-shmetro.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ const Line = (props: { paths: servicesPath[]; direction: 'l' | 'r' }) => {
137137
// the following line is a special case for pujiang line
138138
// where its pass line color should be white with outline
139139
// surrounding it, see #161 for details.
140-
filter={theme[2] === '#999999' ? 'url(#colorreplace)' : undefined}
140+
filter={theme[2] === '#999999' ? 'url(#pujiang_outline_railmap)' : undefined}
141141
>
142142
<g>
143143
{servicePath.pass.map((path, j) => (

src/svgs/railmap/railmap-shmetro.tsx

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -93,18 +93,7 @@ const DefsSHMetro = React.memo(() => (
9393
</feComponentTransfer>
9494
</filter>
9595

96-
<filter id="groupborder" filterUnits="userSpaceOnUse" x="0" y="-300" width="3000" height="500">
97-
<feMorphology operator="dilate" in="SourceAlpha" radius="0" result="e1" />
98-
<feMorphology operator="dilate" in="SourceAlpha" radius="1" result="e2" />
99-
<feComposite in="e1" in2="e2" operator="xor" result="outline" />
100-
{/* <feColorMatrix type="matrix" in="outline"
101-
values="1 0 0 0 0
102-
0 1 0 0 0
103-
0 0 1 0 0
104-
0 0 0 .3 0" result="outline2" /> */}
105-
<feComposite in="outline2" in2="SourceGraphic" operator="over" result="output" />
106-
</filter>
107-
<filter id="colorreplace" colorInterpolationFilters="sRGB"
96+
<filter id="pujiang_outline_railmap" colorInterpolationFilters="sRGB"
10897
// TODO: remove the absolute value while make the filter works correctly
10998
filterUnits="userSpaceOnUse" x="0" y="-1000" width="5000" height="2000">
11099
{/* Replace pass gray color with white.

src/svgs/runin/runin-shmetro.tsx

Lines changed: 42 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,20 @@ const DefsSHMetro = memo(() => (
5656
<marker id="slope" viewBox="-1.5 0 3 1.5" refY={0.5}>
5757
<path d="M0,0L1,1H-1z" fill="var(--rmg-theme-colour)" />
5858
</marker>
59+
60+
{/* Outline filter of white pass color in Pujiang Line */}
61+
<filter id="pujiang_outline_runin" colorInterpolationFilters="sRGB"
62+
// TODO: remove the absolute value while make the filter works correctly
63+
filterUnits="userSpaceOnUse" x="0" y="-1000" width="5000" height="2000">
64+
<feMorphology operator="erode" in="SourceAlpha"
65+
radius="0" result="e1" />
66+
<feMorphology operator="erode" in="SourceAlpha"
67+
radius="1" result="e2" />
68+
<feComposite in="e1" in2="e2" operator="xor"
69+
result="outline" />
70+
<feComposite in="outline" in2="SourceGraphic"
71+
operator="over" result="output" />
72+
</filter>
5973
</defs>
6074
));
6175

@@ -95,27 +109,32 @@ const GeneralStation = (props: RunInGeneralProps) => {
95109
/>
96110
)}
97111
{props.prevStnIds.length > 1 && (
98-
<path
99-
stroke="gray"
100-
d={
101-
param.direction === 'l'
102-
? `M${(param.svgWidth.runin / 3) * 2},125 L${(param.svgWidth.runin / 6) * 5},${prevBranchLineDy} H${
103-
param.svgWidth.runin - 24
104-
}`
105-
: `M${param.svgWidth.runin / 3},125 L${param.svgWidth.runin / 6},${prevBranchLineDy} H24`
106-
}
107-
/>
112+
<g
113+
filter={param.theme[2] === '#999999' ? 'url(#pujiang_outline_railmap)' : undefined}>
114+
<path
115+
stroke="var(--rmg-grey)"
116+
d={
117+
param.direction === 'l'
118+
? `M${(param.svgWidth.runin / 3) * 2},125 L${(param.svgWidth.runin / 6) * 5},${prevBranchLineDy} H${param.svgWidth.runin - 24
119+
}`
120+
: `M${param.svgWidth.runin / 3},125 L${param.svgWidth.runin / 6},${prevBranchLineDy} H24`
121+
}
122+
/>
123+
</g>
108124
)}
109125
</g>
110126

111127
{termianl && param.info_panel_type !== 'sh2020' ? (
112128
<>
113-
<path
114-
transform="translate(0,220)"
115-
stroke="gray"
116-
strokeWidth={12}
117-
d={`M24,16 H ${param.svgWidth.runin - 24}`}
118-
/>
129+
<g
130+
filter={param.theme[2] === '#999999' ? 'url(#pujiang_outline_railmap)' : undefined}>
131+
<path
132+
transform="translate(0,220)"
133+
stroke="var(--rmg-grey)"
134+
strokeWidth={12}
135+
d={`M24,16 H ${param.svgWidth.runin - 24}`}
136+
/>
137+
</g>
119138

120139
<g transform={`translate(${param.direction === 'l' ? 36 : param.svgWidth.runin - 36},160)`}
121140
textAnchor={param.direction === 'l' ? 'start' : 'end'} >
@@ -149,10 +168,13 @@ const GeneralStation = (props: RunInGeneralProps) => {
149168
d={`M ${middle},16 H ${param.direction === 'l' ? 36 : param.svgWidth.runin - 36}`}
150169
markerEnd="url(#slope)"
151170
/>
152-
<path
153-
stroke="gray"
154-
d={`M ${middle},16 H ${param.direction === 'l' ? param.svgWidth.runin - 24 : 24} `}
155-
/>
171+
<g
172+
filter={param.theme[2] === '#999999' ? 'url(#pujiang_outline_railmap)' : undefined}>
173+
<path
174+
stroke="var(--rmg-grey)"
175+
d={`M ${middle},16 H ${param.direction === 'l' ? param.svgWidth.runin - 24 : 24} `}
176+
/>
177+
</g>
156178
</g>
157179

158180
<g transform={`translate(${middle},160)`} textAnchor="middle">

0 commit comments

Comments
 (0)