all files / diagram/utility/ uml-util.js

98.88% Statements 265/268
86.32% Branches 164/190
100% Functions 13/13
98.87% Lines 262/265
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514   33× 33× 33× 18×   15×     33× 33×   33×       33× 33×   33×                                               33× 33× 33× 33× 33× 33× 33× 33× 33× 33× 33× 33×   33× 15× 15× 14×   15× 15× 15×                                         15× 15× 15× 15× 15× 15×   15×               25× 25× 19× 19× 19× 62× 62× 62× 49×   13×         62× 56× 56×     62× 62× 62×                                   62× 62× 62× 62× 62× 62× 10×   62×                                                                       14×                                                                 33× 20× 20× 20× 20× 20× 20× 23× 23× 17×           23× 23× 19×     15×   19×         23× 19× 19×   19×   23× 23× 23×                                       23× 23× 23× 23× 23× 23×   23×                     13×                                                                             57×               57× 57× 57×             112× 112× 112× 112× 112× 112× 112× 112× 112× 112× 112× 112× 112× 112× 112× 112×      
define(["require", "exports", "../enum/enum", "../objects/node", "./../utility/base-util"], function (require, exports, enum_1, node_1, base_util_1) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    function getULMClassifierShapes(content, node, diagram) {
        var classifier;
        var textWrap = 'NoWrap';
        if (node.shape.classifier === 'Class') {
            classifier = node.shape.classShape;
        }
        else if (node.shape.classifier === 'Enumeration') {
            classifier = node.shape.enumerationShape;
        }
        else Eif (node.shape.classifier === 'Interface') {
            classifier = node.shape.interfaceShape;
        }
        node.container = { type: 'Stack', orientation: 'Vertical' };
        node.constraints = (enum_1.NodeConstraints.Default | enum_1.NodeConstraints.HideThumbs) &
            ~(enum_1.NodeConstraints.Rotate | enum_1.NodeConstraints.Resize);
        node.style = {
            fill: node.style.fill, strokeColor: node.style.strokeColor,
            strokeWidth: 1.5
        };
        node.children = [];
        if (node.maxWidth) {
            textWrap = 'Wrap';
        }
        var newObj = new node_1.Node(diagram, 'nodes', {
            id: node.id + '_umlClass_header',
            annotations: [
                {
                    id: 'name', content: classifier.name,
                    offset: { x: 0.5, y: 0.65 }, margin: { left: 10, right: 10 },
                    style: {
                        bold: true, fontSize: 14, color: classifier.style.color, fill: classifier.style.fill,
                        textWrapping: textWrap
                    }
                }, {
                    content: '<<' + node.shape.classifier + '>>', margin: { left: 10, right: 10 },
                    id: 'class', style: {
                        fontSize: classifier.style.fontSize,
                        color: classifier.style.color, fill: classifier.style.fill,
                        textWrapping: textWrap
                    }, offset: { x: 0.5, y: 0.3 }, constraints: enum_1.AnnotationConstraints.ReadOnly
                }
            ],
            constraints: (enum_1.NodeConstraints.Default | enum_1.NodeConstraints.HideThumbs) & ~(enum_1.NodeConstraints.Rotate | enum_1.NodeConstraints.Drag | enum_1.NodeConstraints.Resize),
            verticalAlignment: 'Stretch',
            horizontalAlignment: 'Stretch',
            style: { fill: node.style.fill, strokeColor: (node.style.strokeColor === 'black') ? '#ffffff00' : node.style.strokeColor }
        }, true);
        diagram.initObject(newObj);
        diagram.nodes.push(newObj);
        diagram.UpdateBlazorDiagramModel(newObj, 'Node');
        node.children.push(newObj.id);
        getClassNodes(node, diagram, classifier, textWrap);
        getClassMembers(node, diagram, classifier, textWrap);
        node.offsetX = node.offsetX;
        node.offsetY = node.offsetY;
        node.style.fill = node.style.fill;
        node.borderColor = node.borderColor;
        diagram.initObject(node);
        return content;
    }
    exports.getULMClassifierShapes = getULMClassifierShapes;
    function getClassNodes(node, diagram, classifier, textWrap) {
        if (node.shape.classifier === 'Enumeration') {
            var member = classifier.members;
            if (member && member.length) {
                addSeparator(node, diagram);
                var memberText = '';
                for (var i = 0; i < member.length; i++) {
                    var members = member[parseInt(i.toString(), 10)];
                    if (members.name !== '') {
                        memberText += members.name;
                    }
                    Eif (i !== member.length) {
                        var style = getStyle(node, members);
                        var temp = new node_1.Node(diagram, 'nodes', {
                            id: base_util_1.randomId() + '_umlMember',
                            annotations: [
                                {
                                    id: 'name', content: memberText, offset: { x: 0, y: 0.5 },
                                    style: {
                                        bold: true, fontSize: style.fontSize, color: style.color, fill: style.fill,
                                        textWrapping: textWrap, italic: style.italic, fontFamily: style.fontFamily,
                                        whiteSpace: style.whiteSpace, textAlign: style.textAlign,
                                        textDecoration: style.textDecoration, textOverflow: style.textOverflow
                                    },
                                    margin: { left: 14, right: 5 }, horizontalAlignment: 'Left'
                                }
                            ], verticalAlignment: 'Stretch', horizontalAlignment: 'Stretch',
                            style: {
                                fill: node.style.fill, strokeColor: (node.style.strokeColor === 'black') ?
                                    '#ffffff00' : node.style.strokeColor, textWrapping: textWrap
                            },
                            constraints: (enum_1.NodeConstraints.Default | enum_1.NodeConstraints.HideThumbs) & ~(enum_1.NodeConstraints.Rotate | enum_1.NodeConstraints.Drag | enum_1.NodeConstraints.Resize),
                            minHeight: 25
                        }, true);
                        diagram.initObject(temp);
                        diagram.nodes.push(temp);
                        diagram.UpdateBlazorDiagramModel(temp, 'Node');
                        node.children.push(temp.id);
                        memberText = '';
                        if (members.isSeparator && (i !== member.length - 1)) {
                            addSeparator(node, diagram, members.separatorStyle);
                        }
                        Iif (members.isSeparator && (i === member.length - 1)) {
                            members.isSeparator = false;
                        }
                    }
                }
            }
        }
        else {
            var attributes = classifier.attributes;
            if (attributes.length) {
                var attributeText = '';
                addSeparator(node, diagram);
                for (var i = 0; i < attributes.length; i++) {
                    var text = void 0;
                    var attribute = attributes[parseInt(i.toString(), 10)];
                    if (attribute.scope && (attribute).scope === 'Public') {
                        text = ' +';
                    }
                    else if (attribute.scope && attribute.scope === 'Private') {
                        text = '-';
                    }
                    else if (attribute.scope && attribute.scope === 'Protected') {
                        text = '#';
                    }
                    else {
                        text = '~';
                    }
                    if (attribute.name !== '') {
                        Eif (text) {
                            attributeText += text + ' ' + attribute.name + ' ' + ': ' + attribute.type;
                        }
                    }
                    Eif (i !== attributes.length) {
                        var style = getStyle(node, attribute);
                        var temp = new node_1.Node(diagram, 'nodes', {
                            id: base_util_1.randomId() + '_umlProperty', style: { fill: node.style.fill,
                                strokeColor: (node.style.strokeColor === 'black') ? '#ffffff00' : node.style.strokeColor },
                            annotations: [
                                {
                                    id: 'name', content: attributeText, offset: { x: 0, y: 0.5 },
                                    style: {
                                        bold: true, fontSize: style.fontSize, color: style.color, fill: style.fill,
                                        textWrapping: textWrap, italic: style.italic, fontFamily: style.fontFamily,
                                        whiteSpace: style.whiteSpace, textAlign: style.textAlign,
                                        textDecoration: style.textDecoration, textOverflow: style.textOverflow
                                    },
                                    margin: { left: 14, right: 5 }, horizontalAlignment: 'Left'
                                }
                            ], verticalAlignment: 'Stretch', horizontalAlignment: 'Stretch',
                            constraints: (enum_1.NodeConstraints.Default | enum_1.NodeConstraints.HideThumbs) & ~(enum_1.NodeConstraints.Rotate | enum_1.NodeConstraints.Drag | enum_1.NodeConstraints.Resize),
                            minHeight: 25
                        }, true);
                        diagram.initObject(temp);
                        diagram.nodes.push(temp);
                        diagram.UpdateBlazorDiagramModel(temp, 'Node');
                        node.children.push(temp.id);
                        attributeText = '';
                        if (attribute.isSeparator && (i !== attributes.length - 1)) {
                            addSeparator(node, diagram, attribute.separatorStyle);
                        }
                        if (attribute.isSeparator && (i === attributes.length - 1)) {
                            attribute.isSeparator = false;
                        }
                    }
                }
            }
        }
    }
    exports.getClassNodes = getClassNodes;
    function getClassNodesChild(node, diagram, classifier, textWrap) {
        Eif (node.shape.classifier === 'Enumeration') {
            var member = classifier.members;
            var memberText = '';
            if (member.length === 1) {
                var newIndex = member.length;
                addSeparatorChild(node, diagram, newIndex);
            }
            var count = 0;
            for (var i = 0; i < member.length - 1; i++) {
                if (member[parseInt(i.toString(), 10)].isSeparator === true) {
                    count++;
                }
            }
            var index = member.length + count + 1;
            for (var i = 0; i < member.length; i++) {
                var members = member[member.length - 1];
                Eif (members.name !== '') {
                    memberText += members.name;
                }
                Eif (i !== member.length) {
                    var style = getStyle(node, members);
                    var temp = new node_1.Node(diagram, 'nodes', {
                        id: base_util_1.randomId() + '_umlMember',
                        annotations: [
                            {
                                id: 'name', content: memberText, offset: { x: 0, y: 0.5 },
                                style: {
                                    bold: true, fontSize: style.fontSize, color: style.color, fill: style.fill,
                                    textWrapping: textWrap, italic: style.italic, fontFamily: style.fontFamily,
                                    whiteSpace: style.whiteSpace, textAlign: style.textAlign,
                                    textDecoration: style.textDecoration, textOverflow: style.textOverflow
                                },
                                margin: { left: 14, right: 5 }, horizontalAlignment: 'Left'
                            }
                        ], verticalAlignment: 'Stretch', horizontalAlignment: 'Stretch',
                        style: {
                            fill: node.style.fill, strokeColor: (node.style.strokeColor === 'black') ?
                                '#ffffff00' : node.style.strokeColor, textWrapping: textWrap
                        },
                        constraints: (enum_1.NodeConstraints.Default | enum_1.NodeConstraints.HideThumbs) & ~(enum_1.NodeConstraints.Rotate | enum_1.NodeConstraints.Drag | enum_1.NodeConstraints.Resize),
                        minHeight: 25
                    }, true);
                    temp.parentId = node.id;
                    temp.umlIndex = index;
                    diagram.add(temp);
                    memberText = '';
                }
                break;
            }
        }
    }
    exports.getClassNodesChild = getClassNodesChild;
    function getClassAttributesChild(node, diagram, classifier, textWrap) {
        Eif (classifier.attributes && classifier.attributes.length) {
            var attributes = classifier.attributes;
            var attributeText = '';
            var text = void 0;
            if (attributes.length === 1) {
                var newIndex = attributes.length;
                addSeparatorChild(node, diagram, newIndex);
            }
            var count = 0;
            for (var i = 0; i < attributes.length - 1; i++) {
                if (attributes[parseInt(i.toString(), 10)].isSeparator === true) {
                    count++;
                }
            }
            var index = attributes.length + count + 1;
            for (var i = 0; i < attributes.length; i++) {
                var attribute = attributes[attributes.length - 1];
                if (attribute.scope && (attribute).scope === 'Public') {
                    text = ' +';
                }
                else if (attribute.scope && attribute.scope === 'Private') {
                    text = '-';
                }
                else if (attribute.scope && attribute.scope === 'Protected') {
                    text = '#';
                }
                else {
                    text = '~';
                }
                Eif (attribute.name !== '') {
                    Eif (text) {
                        attributeText += text + ' ' + attribute.name + ' ' + ': ' + attribute.type;
                    }
                }
                Eif (i !== attributes.length) {
                    var style = getStyle(node, attribute);
                    var temp = new node_1.Node(diagram, 'nodes', {
                        id: base_util_1.randomId() + '_umlProperty', style: {
                            fill: node.style.fill,
                            strokeColor: (node.style.strokeColor === 'black') ? '#ffffff00' : node.style.strokeColor
                        },
                        annotations: [
                            {
                                id: 'name', content: attributeText, offset: { x: 0, y: 0.5 },
                                style: {
                                    bold: true, fontSize: style.fontSize, color: style.color, fill: style.fill,
                                    textWrapping: textWrap, italic: style.italic, fontFamily: style.fontFamily,
                                    whiteSpace: style.whiteSpace, textAlign: style.textAlign,
                                    textDecoration: style.textDecoration, textOverflow: style.textOverflow
                                },
                                margin: { left: 14, right: 5 }, horizontalAlignment: 'Left'
                            }
                        ], verticalAlignment: 'Stretch', horizontalAlignment: 'Stretch',
                        constraints: (enum_1.NodeConstraints.Default | enum_1.NodeConstraints.HideThumbs) & ~(enum_1.NodeConstraints.Rotate | enum_1.NodeConstraints.Drag | enum_1.NodeConstraints.Resize),
                        minHeight: 25
                    }, true);
                    temp.parentId = node.id;
                    temp.umlIndex = index;
                    diagram.add(temp);
                    attributeText = '';
                }
                break;
            }
        }
    }
    exports.getClassAttributesChild = getClassAttributesChild;
    function getClassMembers(node, diagram, classifier, textWrap) {
        if (classifier.methods && classifier.methods.length) {
            var methods = classifier.methods;
            addSeparator(node, diagram);
            var argumentText = '';
            var methodText = '';
            var text = void 0;
            for (var i = 0; i < methods.length; i++) {
                var method = methods[parseInt(i.toString(), 10)];
                if (method.scope && method.scope === 'Public') {
                    text = ' +';
                }
                else if (method.scope && method.scope === 'Private') {
                    text = '-';
                }
                else if (method.scope && method.scope === 'Protected') {
                    text = '#';
                }
                else {
                    text = '~';
                }
                Eif (method.parameters) {
                    for (var j = 0; j < method.parameters.length; j++) {
                        if (method.parameters[parseInt(j.toString(), 10)].type) {
                            argumentText += method.parameters[parseInt(j.toString(), 10)].name + ':' + method.parameters[parseInt(j.toString(), 10)].type;
                        }
                        else {
                            argumentText += method.parameters[parseInt(j.toString(), 10)].name;
                        }
                        Iif (j !== method.parameters.length - 1) {
                            argumentText += ',';
                        }
                    }
                }
                if (method.name !== '') {
                    Eif (text) {
                        methodText += text + ' ' + method.name + '(' + argumentText + ')' + ' ' + ':' + ' ' + method.type;
                    }
                    argumentText = '';
                }
                Eif (i !== methods.length) {
                    var style = getStyle(node, method);
                    var temp = new node_1.Node(diagram, 'nodes', {
                        id: base_util_1.randomId() + '_umlMethods', verticalAlignment: 'Stretch', horizontalAlignment: 'Stretch',
                        annotations: [
                            {
                                id: 'name', content: methodText, offset: { x: 0, y: 0.5 },
                                style: {
                                    bold: true, fontSize: style.fontSize, color: style.color, fill: style.fill,
                                    textWrapping: textWrap, italic: style.italic, fontFamily: style.fontFamily,
                                    whiteSpace: style.whiteSpace, textAlign: style.textAlign,
                                    textDecoration: style.textDecoration, textOverflow: style.textOverflow
                                },
                                margin: { left: 14, right: 5 }, horizontalAlignment: 'Left'
                            }
                        ],
                        style: {
                            fill: node.style.fill, strokeColor: (node.style.strokeColor === 'black') ?
                                '#ffffff00' : node.style.strokeColor
                        }, minHeight: 25,
                        constraints: (enum_1.NodeConstraints.Default | enum_1.NodeConstraints.HideThumbs) & ~(enum_1.NodeConstraints.Rotate | enum_1.NodeConstraints.Drag | enum_1.NodeConstraints.Resize)
                    }, true);
                    diagram.initObject(temp);
                    diagram.nodes.push(temp);
                    diagram.UpdateBlazorDiagramModel(temp, 'Node');
                    node.children.push(temp.id);
                    methodText = '';
                    if (method.isSeparator && (i !== methods.length - 1)) {
                        addSeparator(node, diagram, method.separatorStyle);
                    }
                    if (method.isSeparator && (i === methods.length - 1)) {
                        method.isSeparator = false;
                    }
                }
            }
        }
    }
    exports.getClassMembers = getClassMembers;
    function getClassMembersChild(node, diagram, classifier, textWrap) {
        Eif (classifier.methods && classifier.methods.length) {
            var methods = classifier.methods;
            var argumentText = '';
            var methodText = '';
            var text = void 0;
            var initialIndex = 1;
            var index = void 0;
            var attributeCount = 0;
            var methodCount = 0;
            var shapeModel = node.shape;
            var isClass = shapeModel.classifier === 'Class';
            var isInterface = shapeModel.classifier === 'Interface';
            var umlShape = isClass ? shapeModel.classShape : shapeModel.interfaceShape;
            if (methods.length === 1) {
                if (umlShape.attributes.length > 0) {
                    attributeCount = umlShape.attributes.filter(function (attr) { return attr.isSeparator; }).length;
                    initialIndex = 1 + 1 + umlShape.attributes.length + attributeCount;
                    index = initialIndex + 1;
                    addSeparatorChild(node, diagram, initialIndex);
                }
                else {
                    index = initialIndex + 1;
                }
            }
            else {
                attributeCount = umlShape.attributes.filter(function (attr) { return attr.isSeparator; }).length;
                methodCount = umlShape.methods.filter(function (method) { return method.isSeparator; }).length;
                initialIndex = 1 + 1 + umlShape.attributes.length + attributeCount + umlShape.methods.length + methodCount;
                index = initialIndex + 1;
            }
            for (var i = 0; i < methods.length; i++) {
                var method = methods[methods.length - 1];
                if (method.scope && method.scope === 'Public') {
                    text = ' +';
                }
                else if (method.scope && method.scope === 'Private') {
                    text = '-';
                }
                else if (method.scope && method.scope === 'Protected') {
                    text = '#';
                }
                else {
                    text = '~';
                }
                Eif (method.parameters) {
                    for (var j = 0; j < method.parameters.length; j++) {
                        if (method.parameters[parseInt(j.toString(), 10)].type) {
                            argumentText += method.parameters[parseInt(j.toString(), 10)].name + ':' + method.parameters[parseInt(j.toString(), 10)].type;
                        }
                        else {
                            argumentText += method.parameters[parseInt(j.toString(), 10)].name;
                        }
                        Iif (j !== method.parameters.length - 1) {
                            argumentText += ',';
                        }
                    }
                }
                Eif (method.name !== '') {
                    Eif (text) {
                        methodText += text + ' ' + method.name + '(' + argumentText + ')' + ' ' + ':' + ' ' + method.type;
                    }
                }
                Eif (i !== methods.length) {
                    var style = getStyle(node, method);
                    var temp = new node_1.Node(diagram, 'nodes', {
                        id: base_util_1.randomId() + '_umlMethods', verticalAlignment: 'Stretch', horizontalAlignment: 'Stretch',
                        annotations: [
                            {
                                id: 'name', content: methodText, offset: { x: 0, y: 0.5 },
                                style: {
                                    bold: true, fontSize: style.fontSize, color: style.color, fill: style.fill,
                                    textWrapping: textWrap, italic: style.italic, fontFamily: style.fontFamily,
                                    whiteSpace: style.whiteSpace, textAlign: style.textAlign,
                                    textDecoration: style.textDecoration, textOverflow: style.textOverflow
                                },
                                margin: { left: 14, right: 5 }, horizontalAlignment: 'Left'
                            }
                        ],
                        style: {
                            fill: node.style.fill, strokeColor: (node.style.strokeColor === 'black') ?
                                '#ffffff00' : node.style.strokeColor
                        }, minHeight: 25,
                        constraints: (enum_1.NodeConstraints.Default | enum_1.NodeConstraints.HideThumbs) & ~(enum_1.NodeConstraints.Rotate | enum_1.NodeConstraints.Drag | enum_1.NodeConstraints.Resize)
                    }, true);
                    temp.parentId = node.id;
                    temp.umlIndex = index;
                    diagram.add(temp);
                    methodText = '';
                }
                break;
            }
        }
    }
    exports.getClassMembersChild = getClassMembersChild;
    function addSeparator(stack, diagram, SeperatorStyle) {
        var lineObject = new node_1.Node(diagram, 'nodes', {
            id: base_util_1.randomId() + '_path', height: 1, constraints: enum_1.NodeConstraints.Default & ~(enum_1.NodeConstraints.Select),
            verticalAlignment: 'Stretch', horizontalAlignment: 'Stretch',
            style: {
                strokeColor: (stack.style.strokeColor === 'black') ? '#ffffff00' : stack.style.strokeColor,
                fill: SeperatorStyle ? SeperatorStyle.fill : 'white'
            }
        }, true);
        diagram.initObject(lineObject);
        diagram.nodes.push(lineObject);
        stack.children.push(lineObject.id);
    }
    exports.addSeparator = addSeparator;
    function addSeparatorChild(stack, diagram, newIndex) {
        var lineObject = new node_1.Node(diagram, 'nodes', {
            id: base_util_1.randomId() + '_path', height: 1, constraints: enum_1.NodeConstraints.Default & ~(enum_1.NodeConstraints.Select),
            verticalAlignment: 'Stretch', horizontalAlignment: 'Stretch',
            style: { strokeColor: (stack.style.strokeColor === 'black') ? '#ffffff00' : stack.style.strokeColor, fill: 'white' }
        }, true);
        lineObject.parentId = stack.id;
        lineObject.umlIndex = newIndex;
        diagram.add(lineObject);
    }
    exports.addSeparatorChild = addSeparatorChild;
    function getStyle(stack, node) {
        var newStyle = {};
        var style = node.style;
        newStyle.fill = (style.fill !== 'transparent') ? style.fill : stack.style.fill;
        newStyle.color = style.color;
        newStyle.fontFamily = (style.fontFamily !== 'Arial') ? style.fontFamily : stack.style.fontFamily;
        newStyle.italic = style.italic;
        newStyle.bold = style.bold;
        newStyle.whiteSpace = style.whiteSpace;
        newStyle.textAlign = style.textAlign;
        newStyle.textWrapping = style.textWrapping;
        newStyle.textDecoration = style.textDecoration;
        newStyle.textOverflow = style.textOverflow;
        newStyle.fontSize = (style.fontSize !== 12) ? style.fontSize : stack.style.fontSize;
        newStyle.strokeColor = (style.strokeColor !== 'black') ? style.strokeColor : stack.style.strokeColor;
        newStyle.strokeWidth = (style.strokeWidth !== 1) ? style.strokeWidth : stack.style.strokeWidth;
        return newStyle;
    }
    exports.getStyle = getStyle;
});