mirror of
https://github.com/UnickSoft/graphonline.git
synced 2026-04-13 19:26:21 +00:00
Added setup dialog for background.
This commit is contained in:
38
script/BaseBackgroundDrawer.js
Normal file
38
script/BaseBackgroundDrawer.js
Normal file
@@ -0,0 +1,38 @@
|
||||
/**
|
||||
* Graph drawer.
|
||||
*/
|
||||
|
||||
|
||||
function CommonBackgroundStyle()
|
||||
{
|
||||
this.commonColor = '#ffffff';
|
||||
this.commonOpacity = 1.0;
|
||||
}
|
||||
|
||||
function PrintBackgroundStyle()
|
||||
{
|
||||
this.commonColor = '#ffffff';
|
||||
this.commonOpacity = 1.0;
|
||||
}
|
||||
|
||||
function BaseBackgroundDrawer(context)
|
||||
{
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
BaseBackgroundDrawer.prototype.Draw = function(style, width, height, position, scale)
|
||||
{
|
||||
var context = this.context;
|
||||
|
||||
var rect = new Rect(position, position.add(new Point(width / scale, height / scale)));
|
||||
|
||||
context.clearRect(-rect.minPoint.x, -rect.minPoint.y, rect.size().x + 1, rect.size().y + 1);
|
||||
|
||||
if (style.commonOpacity > 0.0)
|
||||
{
|
||||
context.globalAlpha = style.commonOpacity;
|
||||
context.fillStyle = style.commonColor;
|
||||
context.fillRect(-rect.minPoint.x, -rect.minPoint.y, rect.size().x + 1, rect.size().y + 1);
|
||||
context.globalAlpha = 1.0;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user