asual / mxgraph-factory

A tiny CommonJS wrapper for mxGraph
Apache License 2.0
10 stars 8 forks source link

How can I extend the original mxGraph prototype? #4

Open awesomenkj opened 4 years ago

awesomenkj commented 4 years ago

How can I extend the original mxGraph prototype? Something like this.

mxGraph.prototype.pageBreakColor = '#c0c0c0';
....
 var graphUpdatePageBreaks = mxGraph.prototype.updatePageBreaks;

mxGraph.prototype.updatePageBreaks = function(visible, width, height)
{
    var useCssTranforms = this.useCssTransforms, scale = this.view.scale, 
        translate = this.view.translate;

    if (useCssTranforms)
    {
        this.view.scale = 1;
        this.view.translate = new mxPoint(0, 0);
        this.useCssTransforms = false;
    }

    graphUpdatePageBreaks.apply(this, arguments);

    if (useCssTranforms)
    {
        this.view.scale = scale;
        this.view.translate = translate;
        this.useCssTransforms = true;
    }
};
tbouffard commented 4 years ago

@rabpeter have you been able to fix you issue? It seems that you have copied/adapted this repository to manage your own solution

awesomenkj commented 4 years ago

@tbouffard Yep. I solved the problem with my own packages and published them on NPM. https://www.npmjs.com/package/ts-mxgraph

tbouffard commented 4 years ago

@rabpeter cool, good news then.

I am aware of your package because I work on a project that have forked it (https://github.com/process-analytics/ts-mxgraph) to add missing mxGraph type defintions. That's why I contacted you in https://github.com/rabpeter/ts-mxgraph-typings/issues/1 as I did with the asual/mxgraph-factory repository owner (see #9) to know if you would be interested in joining a dedicated community initiative to provide mxGraph type definitions through the DefinitelyTyped project.

tbouffard commented 4 years ago

@rabpeter hello are you still interested in or working on mxgraph typescript integration? I would like to talk to you about https://github.com/rabpeter/ts-mxgraph-typings/issues/1