summaryrefslogtreecommitdiff
path: root/metapost
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2013-03-28 23:10:00 +0100
committerHans Hagen <pragma@wxs.nl>2013-03-28 23:10:00 +0100
commit440c540ebb92c441725ee888eb9ad8b025f4c685 (patch)
tree1a9c702a3c22c4741e7c8996e0797785e2d70298 /metapost
parent1d8e1e7dc2338741c1f124175c229a230ffb1ff3 (diff)
downloadcontext-440c540ebb92c441725ee888eb9ad8b025f4c685.tar.gz
beta 2013.03.28 23:10
Diffstat (limited to 'metapost')
-rw-r--r--metapost/context/base/mp-chem.mpiv70
1 files changed, 33 insertions, 37 deletions
diff --git a/metapost/context/base/mp-chem.mpiv b/metapost/context/base/mp-chem.mpiv
index 4cb4ce78e..c3dd3e3eb 100644
--- a/metapost/context/base/mp-chem.mpiv
+++ b/metapost/context/base/mp-chem.mpiv
@@ -32,7 +32,7 @@ numeric
chem_front_b[] ;
boolean
- chem_setting_axis, %chem_setting_fitwidth, chem_setting_fitheight,
+ chem_setting_axis,
chem_doing_pb, chem_text_trace, chem_bd_wedge, chem_tracing,
chem_star[], chem_front[], chem_stacked[], chem_tetra[] ;
@@ -40,7 +40,6 @@ string
chem_previous ;
path
- chem_setting_bbox,
chem_path[], % scratch
chem_b_path[], chem_c_path[],
chem_r_path[], chem_r_path.lft[], chem_r_path.rt[] ;
@@ -308,20 +307,18 @@ def chem_start_structure(expr i, l, r, t, b, scale, rotation, %fitwidth, fitheig
chem_emwidth := emwidth ; % EmWidth or \the\emwidth does not work...
chem_b_length := if scale<>0: scale* fi 3chem_emwidth ;
-% chem_setting_fitwidth := if boolean fitwidth : fitwidth else : (fitwidth<>0) fi ;
-% chem_setting_fitheight := if boolean fitheight : fitheight else : (fithheight<>0) fi ;;
save chem_setting_l, chem_setting_r, chem_setting_t, chem_setting_b ;
if numeric l :
- chem_setting_l := l * chem_b_length ;
+ chem_setting_l := -l * chem_b_length ;
fi
if numeric r :
- chem_setting_r := r * chem_b_length ;
+ chem_setting_r := r * chem_b_length ;
fi
if numeric t :
- chem_setting_t := t * chem_b_length ;
+ chem_setting_t := t * chem_b_length ;
fi
if numeric b :
- chem_setting_b := b * chem_b_length ;
+ chem_setting_b := -b * chem_b_length ;
fi
chem_setting_rotation := rotation ;
chem_setting_offset := offset ;
@@ -344,36 +341,34 @@ vardef chem_stop_structure =
currentpicture := (currentpicture shifted -chem_origin) rotated chem_setting_rotation ;
- if (not known chem_setting_l) and (not known chem_setting_r) :
- chem_setting_l := - xpart llcorner currentpicture ;
- chem_setting_r := xpart urcorner currentpicture ;
- else :
- if not known chem_setting_l :
- chem_setting_l := xpart urcorner currentpicture - xpart llcorner currentpicture
- - 2chem_setting_r ;
- fi
- if not known chem_setting_r :
- chem_setting_r := xpart urcorner currentpicture - xpart llcorner currentpicture
- - 2chem_setting_l ;
- fi
+% if not known chem_setting_l :
+% chem_setting_l := min(xpart ulcorner currentpicture, xpart llcorner currentpicture) ;
+% fi
+% if not known chem_setting_r :
+% chem_setting_r := max(xpart urcorner currentpicture, xpart lrcorner currentpicture) ;
+% fi
+% if not known chem_setting_b :
+% chem_setting_b := min(ypart llcorner currentpicture, ypart lrcorner currentpicture) ;
+% fi
+% if not known chem_setting_t :
+% chem_setting_t := max(ypart ulcorner currentpicture, ypart urcorner currentpicture) ;
+% fi
+
+ if not known chem_setting_l :
+ chem_setting_l := min(xpart llcorner currentpicture, xpart lrcorner currentpicture) ;
fi
- if (not known chem_setting_t) and (not known chem_setting_b) :
- chem_setting_t := ypart urcorner currentpicture ;
- chem_setting_b := - ypart llcorner currentpicture ;
- else :
- if not known chem_setting_t :
- chem_setting_t := ypart urcorner currentpicture - ypart llcorner currentpicture
- - 2chem_setting_b ;
- fi
- if not known chem_setting_b :
- chem_setting_b := ypart urcorner currentpicture - ypart llcorner currentpicture
- - 2chem_setting_t ;
- fi
+ if not known chem_setting_r :
+ chem_setting_r := max(xpart llcorner currentpicture, xpart lrcorner currentpicture) ;
+ fi
+ if not known chem_setting_b :
+ chem_setting_b := min(ypart llcorner currentpicture, ypart ulcorner currentpicture) ;
+ fi
+ if not known chem_setting_t :
+ chem_setting_t := max(ypart llcorner currentpicture, ypart ulcorner currentpicture) ;
fi
- chem_setting_bbox :=
- (-chem_setting_l,-chem_setting_b) -- ( chem_setting_r,-chem_setting_b) --
- ( chem_setting_r, chem_setting_t) -- (-chem_setting_l, chem_setting_t) -- cycle ;
+% draw textext(decimal chem_setting_l & "," & decimal chem_setting_r & " " &
+% decimal chem_setting_b & "," & decimal chem_setting_t) ;
if chem_setting_axis : % put it behind the picture
chem_pic := currentpicture ; currentpicture := nullpicture ;
chem_num0 := .5chem_b_length ;
@@ -398,13 +393,14 @@ vardef chem_stop_structure =
draw (-chem_num1,i) -- (chem_num1,i)
withpen pencircle scaled chem_axis_rulethickness withcolor colorpart(chem_axis_color) ;
endfor
- % frame=on : draw chem_setting_bbox withcolor colorpart(chem_axis_color) ;
addto currentpicture also chem_pic ;
fi ;
if chem_tracing :
fill boundingbox currentpicture withcolor blue withtransparency(1,.25) ;
fi ;
- setbounds currentpicture to chem_setting_bbox ;
+ setbounds currentpicture to
+ ((chem_setting_l,chem_setting_b) -- (chem_setting_r,chem_setting_b) --
+ (chem_setting_r,chem_setting_t) -- (chem_setting_l,chem_setting_t) -- cycle) ;
if chem_tracing :
fill boundingbox currentpicture withcolor red withtransparency(1,.25) ;
fi ;