@@ -49,18 +49,21 @@ CommonMtableMixin<SVGmtd<N, T, D>, SVGmtr<N, T, D>, SVGConstructor<N, T, D>>(SVG
4949 public static kind = MmlMtable . prototype . kind ;
5050
5151 public static styles : StyleList = {
52- 'g[data-mml-node="mtable"] rect[data-line]' : {
53- 'outline-style' : 'solid' ,
54- 'outline-width' : '70px' ,
55- 'outline-offset' : '-70px' ,
52+ 'g[data-mml-node="mtable"] > line[data-line]' : {
53+ 'stroke-width' : '70px' ,
5654 fill : 'none'
5755 } ,
58- 'g[data-mml-node="mtable"] rect[data-frame]' : {
59- 'outline-style' : 'solid' ,
60- 'outline-width' : '70px' ,
61- 'outline-offset' : '-70px' ,
56+ 'g[data-mml-node="mtable"] > rect[data-frame]' : {
57+ 'stroke-width' : '70px' ,
6258 fill : 'none'
6359 } ,
60+ 'g[data-mml-node="mtable"] > .mjx-dashed' : {
61+ 'stroke-dasharray' : '140'
62+ } ,
63+ 'g[data-mml-node="mtable"] > .mjx-dotted' : {
64+ 'stroke-linecap' : 'round' ,
65+ 'stroke-dasharray' : '0,140'
66+ } ,
6467 'g[data-mml-node="mtable"] > svg' : {
6568 overflow : 'visible'
6669 }
@@ -158,7 +161,7 @@ CommonMtableMixin<SVGmtd<N, T, D>, SVGmtr<N, T, D>, SVGConstructor<N, T, D>>(SVG
158161 let x = this . fLine ;
159162 for ( let i = 0 ; i < lines . length ; i ++ ) {
160163 x += cSpace [ i ] + cWidth [ i ] + cSpace [ i + 1 ] ;
161- this . adaptor . append ( svg , this . makeVLine ( x , lines [ i ] ) ) ;
164+ this . adaptor . append ( svg , this . makeVLine ( x , lines [ i ] , cLines [ i ] ) ) ;
162165 x += cLines [ i ] ;
163166 }
164167 }
@@ -181,7 +184,7 @@ CommonMtableMixin<SVGmtd<N, T, D>, SVGmtr<N, T, D>, SVGConstructor<N, T, D>>(SVG
181184 for ( let i = 0 ; i < lines . length ; i ++ ) {
182185 const [ rH , rD ] = this . getRowHD ( equal , HD , H [ i ] , D [ i ] ) ;
183186 y -= rSpace [ i ] + rH + rD + rSpace [ i + 1 ]
184- this . adaptor . append ( svg , this . makeHLine ( y , lines [ i ] ) ) ;
187+ this . adaptor . append ( svg , this . makeHLine ( y , lines [ i ] , rLines [ i ] ) ) ;
185188 y -= rLines [ i ] ;
186189 }
187190
@@ -229,57 +232,60 @@ CommonMtableMixin<SVGmtd<N, T, D>, SVGmtr<N, T, D>, SVGConstructor<N, T, D>>(SVG
229232 * @return {N } The SVG element for the frame
230233 */
231234 protected makeFrame ( w : number , h : number , d : number , style : string ) {
232- const properties : OptionList = {
233- 'data-frame' : true ,
234- width : this . fixed ( w ) , height : this . fixed ( h + d ) , y : this . fixed ( - d )
235- }
236- if ( style !== 'solid' ) {
237- properties . style = { 'outline-style' : style } ;
238- }
239- return this . svg ( 'rect' , properties ) ;
235+ const t = this . fLine ;
236+ return this . svg ( 'rect' , this . setLineThickness ( t , style , {
237+ 'data-frame' : true , 'class' : 'mjx-' + style ,
238+ width : this . fixed ( w - t ) , height : this . fixed ( h + d - t ) ,
239+ x : this . fixed ( t / 2 ) , y : this . fixed ( t / 2 - d )
240+ } ) ) ;
240241 }
241242
242243 /**
243244 * @param {number } x The x location of the line
244245 * @param {string } style The border style for the line
246+ * @param {number } t The line thickness
245247 * @return {N } The SVG element for the line
246248 */
247- protected makeVLine ( x : number , style : string ) {
249+ protected makeVLine ( x : number , style : string , t : number ) {
248250 const { h, d} = this . getBBox ( ) ;
249- const p = ( style === 'dashed' || style === 'dotted' || style === 'solid' ? 0 : .07 ) ;
250- const properties : OptionList = {
251- width : this . fixed ( .07 + 2 * p ) , height : this . fixed ( h + d + 2 * p ) ,
252- x : this . fixed ( x ) , y : this . fixed ( - d - p ) , 'data-line' : 'v'
253- } ;
254- if ( style !== 'solid' ) {
255- properties . style = { 'outline-style' : style } ;
256- }
257- if ( p ) {
258- properties [ 'clip-path' ] = 'inset(70 130 70 0)' ;
259- }
260- return this . svg ( 'rect' , properties ) ;
251+ const dt = ( style === 'dotted' ? t / 2 : 0 ) ;
252+ const X = this . fixed ( x + t / 2 ) ;
253+ return this . svg ( 'line' , this . setLineThickness ( t , style , {
254+ 'data-line' : 'v' , 'class' : 'mjx-' + style ,
255+ x1 : X , y1 : this . fixed ( dt - d ) , x2 : X , y2 : this . fixed ( h - dt )
256+ } ) ) ;
261257 }
262258
263259 /**
264260 * @param {number } y The y location of the line
265261 * @param {string } style The border style for the line
262+ * @param {number } t The line thickness
266263 * @return {N } The SVG element for the line
267264 */
268- protected makeHLine ( y : number , style : string ) {
265+ protected makeHLine ( y : number , style : string , t : number ) {
269266 const w = this . getBBox ( ) . w ;
270- const p = ( style === 'dashed' || style === 'dotted' || style === 'solid' ? 0 : .07 ) ;
271- const properties : OptionList = {
272- width : this . fixed ( w + 2 * p ) , height : this . fixed ( .07 + 2 * p ) ,
273- y : this . fixed ( y - .07 ) , 'data-line' : 'h'
274- }
275- if ( style !== 'solid' ) {
276- properties . style = { 'outline-style' : style } ;
277- }
278- if ( p ) {
279- properties [ 'clip-path' ] = 'inset(0 70 130 70)' ;
280- properties [ 'x' ] = this . fixed ( - p ) ;
267+ const dt = ( style === 'dotted' ? t / 2 : 0 ) ;
268+ const Y = this . fixed ( y - t / 2 ) ;
269+ return this . svg ( 'line' , this . setLineThickness ( t , style , {
270+ 'data-line' : 'h' , 'class' : 'mjx-' + style ,
271+ x1 : this . fixed ( dt ) , y1 : Y , x2 : this . fixed ( w - dt ) , y2 : Y
272+ } ) ) ;
273+ }
274+
275+ /**
276+ * @param {number } t The thickness of the line
277+ * @param {string } style The border style for the line
278+ * @param {OptionList } properties The list of properties to modify
279+ * @param {OptionList } The modified properties
280+ */
281+ protected setLineThickness ( t : number , style : string , properties : OptionList ) {
282+ if ( t !== .07 ) {
283+ properties [ 'stroke-thickness' ] = this . fixed ( t ) ;
284+ if ( style !== 'solid' ) {
285+ properties [ 'stroke-dasharray' ] = ( style === 'dotted' ? '0,' : '' ) + this . fixed ( 2 * t ) ;
286+ }
281287 }
282- return this . svg ( 'rect' , properties ) ;
288+ return properties
283289 }
284290
285291 /******************************************************************/
0 commit comments