Changeset 20025
- Timestamp:
- 01/29/16 17:42:25 (9 years ago)
- Location:
- issm/trunk-jpl/src/m/plot
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/m/plot/applyoptions.js
r19992 r20025 33 33 var ccontext,ccanvas,ccanvasid,ccanvashtml; 34 34 var colorbarorientiation = options.getfieldvalue('colorbarorientation','vertical'); 35 var cheightoffset = options.getfieldvalue('colorbarfontsize',1 6);36 var cwidthoffset = options.getfieldvalue('colorbarfontsize',1 6)*3;35 var cheightoffset = options.getfieldvalue('colorbarfontsize',18); 36 var cwidthoffset = options.getfieldvalue('colorbarfontsize',18)*3; 37 37 var y; 38 38 var x; … … 119 119 ccontext.lineTo(cwidth,y+cheightoffset); 120 120 ccontext.stroke(); 121 ccontext.font=String(options.getfieldvalue('colorbarfontsize',1 6))+'px Arial';121 ccontext.font=String(options.getfieldvalue('colorbarfontsize',18))+'px "Lato",Helvetica,Arial,sans-serif'; 122 122 ccontext.fillStyle='black'; 123 123 ccontext.textAlign='left'; … … 125 125 } 126 126 if (options.exist('colorbartitle')) { 127 ccontext.font=String(options.getfieldvalue('colorbarfontsize',1 6))+'px Arial';127 ccontext.font=String(options.getfieldvalue('colorbarfontsize',18))+'px "Lato",Helvetica,Arial,sans-serif'; 128 128 ccontext.fillStyle='black'; 129 129 ccontext.textAlign='left'; … … 192 192 ccontext.lineTo(x+cwidthoffset,cheight+cheightoffset); 193 193 ccontext.stroke(); 194 ccontext.font=String(options.getfieldvalue('colorbarfontsize',1 6))+'px Arial';194 ccontext.font=String(options.getfieldvalue('colorbarfontsize',18))+'px "Lato",Helvetica,Arial,sans-serif'; 195 195 ccontext.fillStyle='black'; 196 196 ccontext.textAlign='center'; … … 198 198 } 199 199 if (options.exist('colorbartitle')) { 200 ccontext.font=String(options.getfieldvalue('colorbarfontsize',1 6))+'px Arial';200 ccontext.font=String(options.getfieldvalue('colorbarfontsize',18))+'px "Lato",Helvetica,Arial,sans-serif'; 201 201 ccontext.fillStyle='black'; 202 202 ccontext.textAlign='center'; … … 393 393 node['buffers'] = initBuffers(gl, node['arrays']); 394 394 } //}}} 395 396 //text display //{{{ 397 if (options.exist('textlabels')) { 398 var textcanvas,textcanvasid; 399 textcanvasid = options.getfieldvalue('textcanvasid',options.getfieldvalue('canvasid')+'-text'); 400 textcanvas = $('#'+textcanvasid); 401 textcanvas.textlabels = options.getfieldvalue('textlabels',[]); 402 403 //setup drawing function for text canvas draw calls 404 textcanvas.draw = function(canvas) { 405 var textcontext,textlabels,textlabel,textcanvaswidth,textcanvasheight,textcoordinates; 406 var textposition = vec3.create(); 407 var mvpMatrix = mat4.create(); 408 409 //ensure correct canvas coordinate scaling 410 textcanvaswidth = this[0].clientWidth; 411 textcanvasheight = this[0].clientHeight; 412 this[0].width = textcanvaswidth; 413 this[0].height = textcanvasheight; 414 415 textcontext = this[0].getContext('2d'); 416 textlabels = options.getfieldvalue('textlabels',[]); 417 textcontext.clearRect(0, 0, textcanvaswidth, textcanvasheight); 418 419 //worldspace to screenspace transformation for text 420 for (text in textlabels) { 421 textlabel = textlabels[text]; 422 mat4.multiply(mvpMatrix, canvas.cameraMatrix, canvas.nodes['overlay']['modelMatrix']); 423 textposition = vec3.transformMat4(textposition, textlabel['pos'], mvpMatrix); 424 if (textposition[2] > 1) { //clip coordinates with z > 1 425 continue; 426 } 427 textcoordinates = [(textposition[0]+1.0)/2.0*textcanvaswidth, (-textposition[1]+1.0)/2.0*textcanvasheight]; //NDC to screenspace 428 textcontext.font = String(options.getfieldvalue('colorbarfontsize',18))+'px "Lato",Helvetica,Arial,sans-serif'; 429 textcontext.fillStyle = 'black'; 430 textcontext.strokeStyle = 'black'; 431 textcontext.textAlign = 'center'; 432 textcontext.textBaseline = 'middle'; 433 textcontext.fillText(textlabel['text'], textcoordinates[0], textcoordinates[1]); 434 textcontext.strokeText(textlabel['text'], textcoordinates[0], textcoordinates[1]); 435 } 436 } 437 canvas.textcanvas = textcanvas; 438 } //}}} 395 439 } -
issm/trunk-jpl/src/m/plot/webgl.js
r19992 r20025 465 465 } 466 466 467 if (canvas.textcanvas) { 468 canvas.textcanvas.draw(canvas); 469 } 470 467 471 // Set clear color to black, fully opaque 468 472 var backgroundcolor=new RGBColor(options.getfieldvalue('backgroundcolor','lightcyan'));
Note:
See TracChangeset
for help on using the changeset viewer.