Minor fixes.

This commit is contained in:
Paulo Gustavo Veiga 2023-01-02 13:15:58 -08:00
parent 10a1bf929f
commit 9a8c2a0e97
5 changed files with 7 additions and 18 deletions

View File

@ -57,12 +57,13 @@ class CentralTopic extends Topic {
return null; return null;
} }
/** */
workoutOutgoingConnectionPoint(targetPosition: Point) { workoutOutgoingConnectionPoint(targetPosition: Point) {
$assert(targetPosition, 'targetPoint can not be null'); $assert(targetPosition, 'targetPoint can not be null');
const pos = this.getPosition(); const pos = this.getPosition();
const isAtRight = Shape.isAtRight(targetPosition, pos); const isAtRight = Shape.isAtRight(targetPosition, pos);
const size = this.getSize(); const size = this.getSize();
return Shape.calculateRectConnectionPoint(pos, size, !isAtRight); return Shape.calculateRectConnectionPoint(pos, size, !isAtRight);
} }
} }

View File

@ -1020,11 +1020,11 @@ abstract class Topic extends NodeGraph {
} }
} }
this.redrawShapeType();
this.redraw(true);
// Remove from workspace. // Remove from workspace.
EventBus.instance.fireEvent('topicDisconect', this.getModel()); EventBus.instance.fireEvent('topicDisconect', this.getModel());
this.redrawShapeType();
this.redraw(true);
} }
} }
@ -1088,13 +1088,11 @@ abstract class Topic extends NodeGraph {
children.push(child); children.push(child);
} }
/** */
removeChild(child: Topic): void { removeChild(child: Topic): void {
const children = this.getChildren(); const children = this.getChildren();
this._children = children.filter((c) => c !== child); this._children = children.filter((c) => c !== child);
} }
/** */
getChildren(): Topic[] { getChildren(): Topic[] {
let result = this._children; let result = this._children;
if (!$defined(result)) { if (!$defined(result)) {
@ -1135,12 +1133,10 @@ abstract class Topic extends NodeGraph {
this.redraw(); this.redraw();
} }
/** */
isInWorkspace(): boolean { isInWorkspace(): boolean {
return this._isInWorkspace; return this._isInWorkspace;
} }
/** */
createDragNode(layoutManager: LayoutManager) { createDragNode(layoutManager: LayoutManager) {
const result = super.createDragNode(layoutManager); const result = super.createDragNode(layoutManager);

View File

@ -16,7 +16,7 @@
* limitations under the License. * limitations under the License.
*/ */
import { Point } from '@wisemapping/web2d'; import { Point } from '@wisemapping/web2d';
import { $assert, $defined } from '@wisemapping/core-js'; import { $assert } from '@wisemapping/core-js';
import TopicConfig from '../TopicConfig'; import TopicConfig from '../TopicConfig';
import PositionType from '../PositionType'; import PositionType from '../PositionType';
import SizeType from '../SizeType'; import SizeType from '../SizeType';
@ -24,8 +24,6 @@ import Topic from '../Topic';
class Shape { class Shape {
static isAtRight(sourcePoint: PositionType, targetPoint: PositionType): boolean { static isAtRight(sourcePoint: PositionType, targetPoint: PositionType): boolean {
$assert(sourcePoint, 'Source can not be null');
$assert(targetPoint, 'Target can not be null');
return sourcePoint.x < targetPoint.x; return sourcePoint.x < targetPoint.x;
} }
@ -34,10 +32,6 @@ class Shape {
rectSize: SizeType, rectSize: SizeType,
isAtRight: boolean, isAtRight: boolean,
): PositionType { ): PositionType {
$assert(rectCenterPoint, 'rectCenterPoint can not be null');
$assert(rectSize, 'rectSize can not be null');
$assert($defined(isAtRight), 'isRight can not be null');
// This is used fix a minor difference ...z // This is used fix a minor difference ...z
const correctionHardcode = 2; const correctionHardcode = 2;
let result: PositionType; let result: PositionType;
@ -138,8 +132,6 @@ class Shape {
result.x -= offset; result.x -= offset;
} }
result.x = Math.ceil(result.x);
result.y = Math.ceil(result.y);
return result; return result;
} }
} }

View File

@ -163,7 +163,7 @@ class CurvedLinePeer extends ElementPeer {
} }
static _pointToStr(x, y) { static _pointToStr(x, y) {
return `${(x).toFixed()},${(y).toFixed(1)} `; return `${x.toFixed(1)},${y.toFixed(1)} `;
} }
_updateStyle() { _updateStyle() {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 27 KiB