commit bb8c8991e1c0ee5bddcc8b9e24b5b1c4271710e7
parent 6ed8a76d5e8fd45c5aa99103dc0b83aa3ae51a6a
Author: Davide P. Cervone <dpvc@union.edu>
Date: Wed, 19 Mar 2014 09:43:13 -0400
Merge remote-tracking branch 'dpvc/issue770' into develop. Issue #770.
Diffstat:
1 file changed, 14 insertions(+), 6 deletions(-)
diff --git a/unpacked/jax/output/SVG/jax.js b/unpacked/jax/output/SVG/jax.js
@@ -930,14 +930,18 @@
BBOX.HLINE = BBOX.Subclass({
type: "line", removeable: false,
Init: function (w,t,dash,color,def) {
- if (def == null) {def = {}}
+ if (def == null) {def = {"stroke-linecap":"square"}}
if (color && color !== "") {def.stroke = color}
def["stroke-width"] = t.toFixed(2).replace(/\.?0+$/,"");
- def.x1 = 0; def.y1 = def.y2 = t/2; def.x2 = Math.floor(w);
+ def.x1 = def.y1 = def.y2 = Math.floor(t/2); def.x2 = Math.floor(w-t/2);
if (dash === "dashed") {
- var n = Math.floor(w/(6*t)), m = Math.floor(w/(2*n+1));
+ var n = Math.floor(Math.max(0,w-t)/(6*t)), m = Math.floor(Math.max(0,w-t)/(2*n+1));
def["stroke-dasharray"] = m+" "+m;
}
+ if (dash === "dotted") {
+ def["stroke-dasharray"] = [1,Math.max(150,Math.floor(2*t))].join(" ");
+ def["stroke-linecap"] = "round";
+ }
this.SUPER(arguments).Init.call(this,def);
this.w = this.r = w; this.l = 0; this.h = this.H = t; this.d = this.D = 0;
}
@@ -946,14 +950,18 @@
BBOX.VLINE = BBOX.Subclass({
type: "line", removeable: false,
Init: function (h,t,dash,color,def) {
- if (def == null) {def = {}}
+ if (def == null) {def = {"stroke-linecap":"square"}}
if (color && color !== "") {def.stroke = color}
def["stroke-width"] = t.toFixed(2).replace(/\.?0+$/,"");
- def.x1 = def.x2 = t/2; def.y1 = 0; def.y2 = Math.floor(h);
+ def.x1 = def.x2 = def.y1 = Math.floor(t/2); def.y2 = Math.floor(h-t/2);
if (dash === "dashed") {
- var n = Math.floor(h/(6*t)), m = Math.floor(h/(2*n+1));
+ var n = Math.floor(Math.max(0,h-t)/(6*t)), m = Math.floor(Math.max(0,h-t)/(2*n+1));
def["stroke-dasharray"] = m+" "+m;
}
+ if (dash === "dotted") {
+ def["stroke-dasharray"] = [1,Math.max(150,Math.floor(2*t))].join(" ");
+ def["stroke-linecap"] = "round";
+ }
this.SUPER(arguments).Init.call(this,def);
this.w = this.r = t; this.l = 0; this.h = this.H = h; this.d = this.D = 0;
}