converting to typescript

development
mcyph 2021-04-07 17:13:56 +10:00
parent b654d9cb08
commit 32b49b5563
4 changed files with 790 additions and 788 deletions

View File

@ -8,6 +8,7 @@ import mxPoint from '../../util/datatypes/mxPoint';
import mxRectangle from '../../util/datatypes/mxRectangle';
import mxEventSource from '../../util/event/mxEventSource';
import mxImage from '../../util/image/mxImage';
import mxCellState from "../../util/datatypes/mxCellState";
class mxCellOverlay extends mxEventSource {
/**
@ -48,14 +49,14 @@ class mxCellOverlay extends mxEventSource {
* Holds the offset as an <mxPoint>. The offset will be scaled according to the
* current scale.
*/
offset = null;
offset: mxPoint | null = null;
/**
* Variable: cursor
*
* Holds the cursor for the overlay. Default is 'help'.
*/
cursor = null;
cursor: string = 'help';
/**
* Variable: defaultOverlap
@ -63,7 +64,7 @@ class mxCellOverlay extends mxEventSource {
* Defines the overlapping for the overlay, that is, the proportional distance
* from the origin to the point defined by the alignment. Default is 0.5.
*/
defaultOverlap = 0.5;
defaultOverlap: number = 0.5;
/**
* Class: mxCellOverlay
@ -119,16 +120,18 @@ class mxCellOverlay extends mxEventSource {
* values are <ALIGN_TOP>, <ALIGN_MIDDLE> and <ALIGN_BOTTOM>
* (default).
*/
constructor(image, tooltip, align, verticalAlign, offset, cursor) {
constructor(image: mxImage,
tooltip: string | null=null,
align: string='right',
verticalAlign: string='bottom',
offset: mxPoint=new mxPoint(),
cursor: string='help') {
super();
this.image = image;
this.tooltip = tooltip;
this.align = align != null ? align : this.align;
this.verticalAlign =
verticalAlign != null ? verticalAlign : this.verticalAlign;
this.offset = offset != null ? offset : new mxPoint();
this.cursor = cursor != null ? cursor : 'help';
this.offset = offset;
this.cursor = cursor;
}
/**

File diff suppressed because it is too large Load Diff

View File

@ -605,7 +605,7 @@ class mxGraphModel extends mxEventSource {
*/
add(parent: mxCell | null,
child: mxCell | null,
index: number): mxCell | null {
index: number | null=null): mxCell | null {
if (child !== parent && parent != null && child != null) {
// Appends the child if no index was specified
@ -1677,7 +1677,7 @@ class mxGraphModel extends mxEventSource {
*
* cell - <mxCell> whose collapsed state should be returned.
*/
isCollapsed(cell: mxCell): boolean {
isCollapsed(cell: mxCell | null): boolean {
return cell != null ? cell.isCollapsed() : false;
}

View File

@ -1668,12 +1668,12 @@ class mxGraphView extends mxEventSource {
*
* Returns the edge style function to be used to render the given edge state.
*/
getEdgeStyle(edge,
points,
source,
target) {
getEdgeStyle(edge: mxCell,
points: mxPoint[],
source: mxCell,
target: mxCell): any {
let edgeStyle = this.isLoopStyleEnabled(edge, points, source, target)
let edgeStyle: any = this.isLoopStyleEnabled(edge, points, source, target)
? mxUtils.getValue(
edge.style,
mxConstants.STYLE_LOOP,