Commit 3ea90c60 authored by GoshaZotov's avatar GoshaZotov

for drawing filter mark

parent dc79f188
...@@ -12664,6 +12664,7 @@ ...@@ -12664,6 +12664,7 @@
var colWidth = ws.cols[props.col].width; var colWidth = ws.cols[props.col].width;
var scaleIndex = 1; var scaleIndex = 1;
var scaleFactor = ws.drawingCtx.scaleFactor;
var _drawButtonBorder = function(startX, startY, width, height) var _drawButtonBorder = function(startX, startY, width, height)
{ {
...@@ -12677,7 +12678,7 @@ ...@@ -12677,7 +12678,7 @@
var _drawSortArrow = function(startX, startY, isDescending, heightArrow) var _drawSortArrow = function(startX, startY, isDescending, heightArrow)
{ {
heightArrow = heightArrow * height_1px * scaleIndex; heightArrow = Math.round(heightArrow * height_1px * scaleIndex);
var widthArrow = 3 * width_1px * scaleIndex; var widthArrow = 3 * width_1px * scaleIndex;
var widthLine = 1 * width_1px * scaleIndex; var widthLine = 1 * width_1px * scaleIndex;
var heightEndArrow = 3 * height_1px * scaleIndex; var heightEndArrow = 3 * height_1px * scaleIndex;
...@@ -12687,24 +12688,44 @@ ...@@ -12687,24 +12688,44 @@
var ctx = ws.drawingCtx; var ctx = ws.drawingCtx;
ctx.beginPath(); ctx.beginPath();
ctx.lineVer(startX, startY, startY + heightArrow); ctx.lineVer(startX, startY, startY + heightArrow);
if(isDescending) if(isDescending)
{ {
ctx.moveTo(startX, startY + heightArrow); var r = ws.drawingCtx._calcRect(startX, startY);
ctx.lineTo(startX - (widthArrow - widthLine), startY + heightArrow - heightEndArrow); var x = Math.round(r.x);
ctx.moveTo(startX + widthArrow, startY + heightArrow - heightEndArrow); var y = Math.round(r.y);
ctx.lineTo(startX, startY + heightArrow);
//ctx.lineHor(startX - 2 * width_1px, startY + heightArrow - 1 * height_1px, startX + 3 * width_1px); var heightArrow1 = Math.round(heightArrow * scaleFactor);
var height = Math.round(3 * scaleIndex * scaleFactor);
var diffY = 0;
for(var i = 0; i < height; i++)
{
ws.drawingCtx.ctx.moveTo(x - (i), y + 0.5 - (i) + heightArrow1 + height - 1);
ws.drawingCtx.ctx.lineTo(x - (i) + 1, y + 0.5 - (i) + heightArrow1 + height - 1);
ws.drawingCtx.ctx.moveTo(x + i, y + 0.5 - (i) + heightArrow1 + height - 1);
ws.drawingCtx.ctx.lineTo(x + i + 1, y + 0.5 - (i) + heightArrow1 + height - 1);
}
} }
else else
{ {
ctx.moveTo(startX, startY); var r = ws.drawingCtx._calcRect(startX, startY);
ctx.lineTo(startX - (widthArrow - widthLine), startY + heightEndArrow); var x = Math.round(r.x);
ctx.moveTo(startX + widthArrow, startY + heightEndArrow); var y = Math.round(r.y);
ctx.lineTo(startX, startY);
//ctx.lineHor(startX - widthLine, startY + 1 * height_1px * scaleIndex, startX - widthLine + widthArrow); var height = Math.round(3 * scaleIndex * scaleFactor);
var diffY = 0;
for(var i = 0; i < height; i++)
{
ws.drawingCtx.ctx.moveTo(x - (i), y + 0.5 + (i) - diffY);
ws.drawingCtx.ctx.lineTo(x - (i) + 1, y + 0.5 + (i) - diffY);
ws.drawingCtx.ctx.moveTo(x + i, y + 0.5 + (i) - diffY);
ws.drawingCtx.ctx.lineTo(x + i + 1, y + 0.5 + (i) - diffY);
}
} }
ctx.setLineWidth(t.width_1px); ctx.setLineWidth(t.width_1px);
ctx.setStrokeStyle(m_oColor); ctx.setStrokeStyle(m_oColor);
ctx.stroke(); ctx.stroke();
...@@ -12712,53 +12733,61 @@ ...@@ -12712,53 +12733,61 @@
var _drawFilterMark = function (x, y, height) var _drawFilterMark = function (x, y, height)
{ {
var size = 5.25 * scaleIndex; /*var size = 5.25 * scaleIndex;
var halfSize = Math.round((size / 2) / height_1px) * height_1px; var halfSize = Math.round((size / 2) / height_1px) * height_1px;
var meanLine = Math.round((size * Math.sqrt(3) / 3) / height_1px) * height_1px;//длина биссектрисы равностороннего треугольника var meanLine = Math.round((size * Math.sqrt(3) / 3) / height_1px) * height_1px;//длина биссектрисы равностороннего треугольника*/
//округляем + смещаем //округляем + смещаем
x = Math.round((x) / width_1px) * width_1px; x = Math.round((x) / width_1px) * width_1px;
y = Math.round((y) / height_1px) * height_1px; y = Math.round((y) / height_1px) * height_1px;
var y1 = y - height; var heightLine = Math.round(height);
ws.drawingCtx.beginPath();
ws.drawingCtx ws.drawingCtx
.beginPath() .beginPath()
.moveTo(x, y) .moveTo(x, y)
.lineTo(x, y1) .lineTo(x, y - heightLine)
.setLineWidth(t.width_2px)
.setStrokeStyle(m_oColor) .setStrokeStyle(m_oColor)
.stroke(); .stroke();
ws.drawingCtx
.beginPath() var scaleFactor = ws.drawingCtx.scaleFactor;
.moveTo(x + halfSize, y1) var r = ws.drawingCtx._calcRect(x, y - heightLine);
.lineTo(x + halfSize, y1) x = Math.round(r.x) + 1;
.lineTo(x, y1 + meanLine) y = Math.round(r.y) - 1;
.lineTo(x - halfSize, y1)
.lineTo(x, y1) var height = Math.round(4 * scaleIndex * scaleFactor);
.setFillStyle(m_oColor) var diffY = 0;
.fill(); for(var i = 0; i < height; i++)
{
ws.drawingCtx.ctx.moveTo(x - (i) - 2, y + 0.5 + (height - i) - diffY);
ws.drawingCtx.ctx.lineTo(x + i, y + 0.5 + (height - i) - diffY);
}
ws.drawingCtx.setLineWidth(t.width_1px)
ws.drawingCtx.setStrokeStyle(m_oColor);
ws.drawingCtx.stroke();
}; };
var _drawFilterDreieck = function (x, y, index) var _drawFilterDreieck = function (x, y)
{ {
var size = 5.25 * index; var r = ws.drawingCtx._calcRect(x, y);
//сюда приходят координаты центра кнопки x = Math.round(r.x) + 1;
//чтобы кнопка была в центре, необходимо сместить y = Math.round(r.y);
var leftDiff = size / 2;
var upDiff = Math.round(((size * Math.sqrt(3)) / 6) / height_1px) * height_1px;//радиус вписанной окружности в треугольник ws.drawingCtx.beginPath();
//округляем + смещаем
x = Math.round((x - leftDiff) / width_1px) * width_1px; var height = Math.round(4 * scaleIndex * scaleFactor);
y = Math.round((y - upDiff) / height_1px) * height_1px; var diffY = Math.round(height / 2);
var meanLine = Math.round((size * Math.sqrt(3) / 3) / width_1px) * width_1px;//длина биссектрисы равностороннего треугольника for(var i = 0; i < height; i++)
var halfSize = Math.round((size / 2) / height_1px) * height_1px; {
//рисуем ws.drawingCtx.ctx.moveTo(x - (i + 1), y + 0.5 + (height - i) - diffY);
ws.drawingCtx ws.drawingCtx.ctx.lineTo(x + i, y + 0.5 + (height - i) - diffY);
.beginPath() }
.moveTo(x, y)
.lineTo(x + size, y) ws.drawingCtx.setStrokeStyle(m_oColor);
.lineTo(x + halfSize, y + meanLine) ws.drawingCtx.stroke();
.lineTo(x, y)
.setFillStyle(m_oColor)
.fill();
}; };
//TODO пересмотреть отрисовку кнопок + отрисовку при масштабировании //TODO пересмотреть отрисовку кнопок + отрисовку при масштабировании
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment