Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions src/firefly/js/drawingLayers/NorthUpCompass.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,5 @@ function makeCompass(plotId, action){

//return Arrays.asList(new DrawObj[]{dataN, dataE});
//
var arrows = VisUtil.getArrowCoords();

var pt = makeWorldPt(10.68479, 41.26906);//cc.getWorldCoords(makeImagePt(0, 0));
var obj = ShapeDataObj.makeCircleWithRadius(pt,50);
var txt = ShapeDataObj.makeText(pt,"Text");
obj.color = 'yellow';
return [dataE, dataN];
}
6 changes: 1 addition & 5 deletions src/firefly/js/visualize/draw/DirectionArrowDrawObj.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,7 @@ function drawDirectionArrow(ctx,drawTextAry,startPt,endPt,drawParams,renderOptio

DrawUtil.drawPath(ctx, color,2,drawList,false, renderOptions);

//DrawUtil.drawText(ctx,ret.textX, ret.textY, color, '9px serif', text, renderOptions);

//FIXME:color text black on white background - yellow on white background is not readable
//TODO: better solution would be to adapt text color with background
DrawUtil.drawText(drawTextAry, text, ret.textX, ret.textY,'black', renderOptions);
DrawUtil.drawText(drawTextAry, text, ret.textX, ret.textY, color, renderOptions);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you should take out the todo comments here since it is done.

}

function toRegion(startPt,endPt,plot,drawParams,renderOptions) {
Expand Down
16 changes: 11 additions & 5 deletions src/firefly/js/visualize/draw/DrawUtil.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,14 @@ function drawInnerRecWithHandles(ctx, color, lineWidth, inX1, inY1, inX2, inY2)
* @param size
* @param fontWeight
* @param fontStyle
* @param backGroundColor
* @param padDing
*/
function drawText(drawTextAry,text, x,y,color,
renderOptions,
fontFamily='helvetica', size='9px',
fontWeight='normal', fontStyle='normal') {
fontWeight='normal', fontStyle='normal',
backGroundColor, padDing) {


//todo
Expand All @@ -120,11 +123,14 @@ function drawText(drawTextAry,text, x,y,color,
'fontSize': size,
fontWeight,
fontStyle,
'backgroundColor': 'white',
'MozBorderRadius': '5px',
'borderRadius': '5px',
'WebkitBorderRadius': '5px'
'MozBorderRadius': '1px',
'borderRadius': '1px',
'WebkitBorderRadius': '1px'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would still like to support background at the DrawUtil level. I think you should add a extra parameter at the end (backgroundColor, default it to null or undefined). When a background color is not passed (the normal case), don't set a background color and don't set the padding.

};

if (backGroundColor) style.backgroundColor = backGroundColor;
if (padDing) style.padding = padDing;

drawTextAry.push({text,style});
}

Expand Down
8 changes: 2 additions & 6 deletions src/firefly/js/visualize/draw/ShapeDataObj.js
Original file line number Diff line number Diff line change
Expand Up @@ -629,11 +629,7 @@ export function drawText(drawObj, drawTextAry, plot, inPt, drawParams) {
if (y > south)y = south;
else if (y<height) y= height;

//FIXME:color text black on white background - yellow on white background is not readable
//TODO: better solution would be to adapt text color with background

// in case shape 'text' defines the color of its own
var color = has(drawObj, 'color') ? drawObj.color : 'black';
var color = drawParams.color || drawObj.color || 'black';
DrawUtil.drawText(drawTextAry, text, x, y, color, renderOptions,
fontName+FONT_FALLBACK, fontSize, fontWeight, fontStyle);
drawObj.textWorldLoc = plot.getImageCoords(makeViewPortPt(x, y));
Expand Down Expand Up @@ -1384,4 +1380,4 @@ export function heightAfterRotation(width, height, angle) {
const hcos = height * Math.cos(angle);

return Math.max(Math.abs(wsin-hcos), Math.abs(wsin+hcos));
}
}