Skip to content

Commit

Permalink
progress
Browse files Browse the repository at this point in the history
  • Loading branch information
DOOM committed Jun 28, 2023
1 parent 8cdfbeb commit c102fdc
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
3 changes: 3 additions & 0 deletions code/controllers/subsystem/minimap.dm
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,9 @@ SUBSYSTEM_DEF(minimaps)
. = TRUE

if ("selectAnnouncement")
toolbar_selection = "export"
to_chat(usr, SPAN_WARNING("params1 -> [params["image"]]"))

// params["image"] <- "should" be of type png returned from tgui
. = TRUE

Expand Down
9 changes: 3 additions & 6 deletions tgui/packages/tgui/interfaces/CanvasLayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export class CanvasLayer extends Component {
super(props);
this.canvasRef = createRef();


// color selection
// using this.state prevents unpredictable behavior
this.state = {
Expand Down Expand Up @@ -168,13 +169,9 @@ export class CanvasLayer extends Component {
this.setState({ selection: prevColor });
return;
}
// this has barely been tested, and might be unfunctional, also a better way to do this according to paul.

if (selection === 'export') {
const exportDrawnImage = new Image();
exportDrawnImage.src = this.canvasRef.current.toDataURL();
exportDrawnImage.onload = () => {
onImageExport(exportDrawnImage);
};
this.props.onImageExport(this.canvasRef.current.toDataURL());
return;
}

Expand Down
12 changes: 9 additions & 3 deletions tgui/packages/tgui/interfaces/TacticalMap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,16 @@ export const TacticalMap = (props, context) => {
const { data, act } = useBackend<TacMapProps>(context);

// maybe this is the right way of doing this, maybe not, idk.
const handleTacMapExport = (image: any) => {
data.exportedTacMapImage = image;
const handleTacMapExport = (image: string) => {
if (image === null || image === undefined){
data.exportedTacMapImage = "not found";
}
else {
data.exportedTacMapImage = image;
}
};


return (
<Window title={'Tactical Map'} theme="usmc" width={650} height={750}>
<Window.Content>
Expand All @@ -32,7 +38,7 @@ export const TacticalMap = (props, context) => {
<Section title="Canvas Options">
<Stack>
<Stack.Item grow>
<Button // we should add some icon here maybe, someone redo the ui plz; it's shit.
<Button
fontSize="9px"
fluid={1}
color="grey"
Expand Down

0 comments on commit c102fdc

Please sign in to comment.