-
Notifications
You must be signed in to change notification settings - Fork 37
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
#220 Shanghai Metro Style Station Number #291
Changes from all commits
57e5761
4dd2d41
eefe94a
4732322
e15fd04
95741e8
c1a4c0d
b389a8e
7e3cd7c
fd873d2
74a99e6
d458129
6378579
ac216de
eebfdc1
985254c
d022616
c65599b
a2ae952
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -188,6 +188,14 @@ export interface RMGParam { | |
theme: Theme; | ||
line_name: Name; | ||
current_stn_idx: keyof StationDict; | ||
/** | ||
* Display the station number or not. | ||
*/ | ||
showStationNumber: boolean; | ||
/** | ||
* Display the station number in railmap or not. | ||
*/ | ||
showStationNumberRailmap: boolean; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we really need to distinguish between two scenarios? For stations that only display station number at runin canvas, I believe that is just an obsolete image at will be replaced soon. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Like the resolve of Disney Icon. There're some person reason in it (For my Minecraft server), sorry. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If you need the station number on only one canvas, why not download one canvas and switch the station number button and then download another canvas? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Because now numbers in railmap were replaced, but at Xinjiangwancheng - Hangzhong Road/Hongqiao Railway Station the station numbers on runin also there.(Xinjiangwancheng removed.) |
||
/** | ||
* Key-value pairs of the information of each station. | ||
*/ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,23 @@ | ||
import React, { ChangeEvent, useMemo } from 'react'; | ||
import { useTranslation } from 'react-i18next'; | ||
import { ListItem, ListItemIcon, Icon, ListItemText, Divider, Select } from '@material-ui/core'; | ||
import { | ||
Switch, | ||
ListItem, | ||
ListItemIcon, | ||
Icon, | ||
ListItemText, | ||
Divider, | ||
Select, | ||
makeStyles, | ||
createStyles, | ||
ListItemSecondaryAction, | ||
Collapse, | ||
List, | ||
TextField, | ||
} from '@material-ui/core'; | ||
import { PanelTypeShmetro } from '../../constants/constants'; | ||
import { useAppDispatch, useAppSelector } from '../../redux'; | ||
import { setPanelType } from '../../redux/param/action'; | ||
import { setPanelType, setLineNum, setShowStationNumber, setShowStationNumberRailmap } from '../../redux/param/action'; | ||
|
||
const DesignListShmetro = () => { | ||
return ( | ||
|
@@ -27,30 +41,110 @@ const DesignListShmetro = () => { | |
|
||
export default DesignListShmetro; | ||
|
||
const useStyles = makeStyles(theme => | ||
createStyles({ | ||
dividerVertical: { | ||
margin: theme.spacing(0, 2), | ||
}, | ||
nestedList: { | ||
paddingLeft: theme.spacing(5), | ||
}, | ||
}) | ||
); | ||
|
||
const StationNumberSHMetroLi = () => { | ||
const { t } = useTranslation(); | ||
const classes = useStyles(); | ||
const dispatch = useAppDispatch(); | ||
|
||
const station_number = useAppSelector(store => store.param.showStationNumber); | ||
const station_number_railmap = useAppSelector(store => store.param.showStationNumberRailmap); | ||
const line_number = useAppSelector(store => store.param.line_num); | ||
|
||
return useMemo(() => { | ||
const handleSwitch = (_: React.ChangeEvent<HTMLInputElement>, checked: boolean) => { | ||
if (checked) { | ||
dispatch(setShowStationNumber(true)); | ||
} else { | ||
dispatch(setShowStationNumber(false)); | ||
} | ||
}; | ||
|
||
const handleSwitchSecondary = (_: React.ChangeEvent<HTMLInputElement>, checked: boolean) => { | ||
if (checked) { | ||
dispatch(setShowStationNumberRailmap(true)); | ||
} else { | ||
dispatch(setShowStationNumberRailmap(false)); | ||
} | ||
}; | ||
|
||
const handleChange = ({ target: { value } }: ChangeEvent<HTMLInputElement>) => { | ||
dispatch(setLineNum(value)); | ||
}; | ||
|
||
return ( | ||
<> | ||
<ListItem> | ||
<ListItemIcon> | ||
<Icon>account_balance_wallet</Icon> | ||
</ListItemIcon> | ||
<ListItemText primary={t('design.stationNumber')} /> | ||
<ListItemSecondaryAction> | ||
<Switch color="primary" checked={station_number !== false} onChange={handleSwitch} /> | ||
</ListItemSecondaryAction> | ||
</ListItem> | ||
<Collapse in={station_number !== false} unmountOnExit> | ||
<List component="div" disablePadding className={classes.nestedList}> | ||
<ListItem> | ||
<ListItemText primary={t('design.stationNumberRailmap')} /> | ||
<ListItemSecondaryAction> | ||
<Switch | ||
color="primary" | ||
checked={station_number_railmap !== false} | ||
onChange={handleSwitchSecondary} | ||
/> | ||
</ListItemSecondaryAction> | ||
</ListItem> | ||
<ListItem> | ||
<TextField | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Will you put a label before the line num? Just like what GTMTR did https://github.com/wongchito/RailMapGenerator/blob/rmg-3.12.3/src/panels/design/list-gzmtr.tsx#L63 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ....I forget to do it because there are only one field in part 1. |
||
placeholder={t('design.lineNum')} | ||
defaultValue={line_number} | ||
onChange={handleChange} | ||
/> | ||
</ListItem> | ||
</List> | ||
</Collapse> | ||
</> | ||
); | ||
}, [line_number, station_number, station_number_railmap]); | ||
}; | ||
|
||
const PanelTypeLi = () => { | ||
const { t } = useTranslation(); | ||
const dispatch = useAppDispatch(); | ||
|
||
const panelType = useAppSelector(store => store.param.info_panel_type); | ||
|
||
return useMemo(() => { | ||
const handleChange = ({ target: { value } }: ChangeEvent<{ name?: string; value: unknown }>) => { | ||
dispatch(setPanelType(value as PanelTypeShmetro)); | ||
}; | ||
return ( | ||
<ListItem> | ||
<ListItemIcon> | ||
<Icon style={{ transform: 'rotate(180deg)' }}>credit_card</Icon> | ||
</ListItemIcon> | ||
<ListItemText primary={t('design.panelType.button')} /> | ||
<Select native value={panelType} onChange={handleChange} style={{ width: 166 }}> | ||
{Object.values(PanelTypeShmetro).map(type => ( | ||
<option key={type} value={type}> | ||
{t('design.panelType.' + type)} | ||
</option> | ||
))} | ||
</Select> | ||
</ListItem> | ||
<> | ||
<StationNumberSHMetroLi /> | ||
<ListItem> | ||
<ListItemIcon> | ||
<Icon style={{ transform: 'rotate(180deg)' }}>credit_card</Icon> | ||
</ListItemIcon> | ||
<ListItemText primary={t('design.panelType.button')} /> | ||
<Select native value={panelType} onChange={handleChange} style={{ width: 166 }}> | ||
{Object.values(PanelTypeShmetro).map(type => ( | ||
<option key={type} value={type}> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh! Sorry my test template is using sh2020. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just find a problem: Shanghai Line 10 removed all station number on railmap in the 2012 style (which is the current style (without platform number version) that RMG uses) update although the station number still remain on Running-in): Which now looks like this (the 2020 style also used the normal railmap without station number) (source: https://zhuanlan.zhihu.com/p/57368457) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @52PD Yes, this is the reason why station number in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am going to rewrite it for v5. Thinks that we can make There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm still insisting that |
||
{t('design.panelType.' + type)} | ||
</option> | ||
))} | ||
</Select> | ||
</ListItem> | ||
</> | ||
); | ||
}, [panelType, t, dispatch]); | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As we said before, no need for another class style,
.rmg-name__en
would be fine for numbers.