Added test size settings for vertices and edges.

This commit is contained in:
Oleg Sh
2024-07-15 22:11:38 +02:00
parent b7b14e16e8
commit dac4f9bcb8
31 changed files with 703 additions and 584 deletions

View File

@@ -219,7 +219,8 @@ BaseEdge.prototype.GetEdgePositions = function()
vertices.forEach(function(data)
{
var shape = data.vertex.currentStyle.GetStyle({}, data.vertex).shape;
var style = data.vertex.currentStyle.GetStyle({}, data.vertex);
var shape = style.shape;
if (shape == VertexCircleShape)
{
var direction = data.direction.multiply(0.5);
@@ -230,7 +231,7 @@ BaseEdge.prototype.GetEdgePositions = function()
{
var lineFinish1 = data.direction.multiply(-1).multiply(1000.0);
var pointsVertex1 = GetPointsForShape(shape, data.diameter, data.vertex.mainText);
var pointsVertex1 = GetPointsForShape(shape, data.diameter, {style: style, text: data.vertex.mainText});
pointsVertex1.push(pointsVertex1[0]);
for (var i = 0; i < pointsVertex1.length - 1; i ++)

View File

@@ -104,8 +104,9 @@ BaseVertex.prototype.IsUndefinedPosition = function ()
BaseVertex.prototype.HitTest = function (pos)
{
var shape = this.hasOwnProperty('currentStyle') ? this.currentStyle.GetStyle({}, this).shape : VertexCircleShape;
var width = this.hasOwnProperty('currentStyle') ? this.currentStyle.GetStyle({}, this).lineWidth : 0;
var style = this.hasOwnProperty('currentStyle') ? this.currentStyle.GetStyle({}, this) : null;
var shape = style != null ? style.shape : VertexCircleShape;
var width = style != null ? style.lineWidth : 0;
if (shape == VertexCircleShape)
{
@@ -116,8 +117,12 @@ BaseVertex.prototype.HitTest = function (pos)
var relativePos = (new Point(pos.x, pos.y)).subtract(this.position);
var lineFinish1 = relativePos.add(new Point(1000, 0));
var lineFinish2 = relativePos.add(new Point(-1000, 0));
var pointsVertex1 = GetPointsForShape(shape, this.model.diameter + width, this.mainText);
if (style == null)
{
console.error("Some thing wrong with style");
}
var pointsVertex1 = GetPointsForShape(shape, this.model.diameter + width,
style != null ? {style: style, text: this.mainText} : null);
pointsVertex1.push(pointsVertex1[0]);
var hitNumber1 = 0;