12.4.0 release

This commit is contained in:
Gaudenz Alder 2019-12-12 12:46:48 +01:00
parent 24ec18a21b
commit 941ec4ad13
16 changed files with 1541 additions and 1427 deletions

View file

@ -1,3 +1,10 @@
12-DEC-2019: 12.4.0
- Adds Catalan translations, credit Pere Orga pere@orga.cat
- Fixes drag cells to library, subtree moving live preview
- Fixes conf cloud gliffy mass import paging bug
- Uses mxGraph 4.0.6 beta 10
09-DEC-2019: 12.3.9 09-DEC-2019: 12.3.9
- Fixes NPE in Lucidchart import - Fixes NPE in Lucidchart import

View file

@ -1 +1 @@
12.3.9 12.4.0

View file

@ -1370,39 +1370,40 @@ mxCellStatePreview.prototype.translateState=function(a,b,c){if(null!=a){var d=th
mxCellStatePreview.prototype.revalidateState=function(a,b,c,d){if(null!=a){var e=this.graph.getModel();e.isEdge(a.cell)&&a.view.updateCellState(a);var f=this.graph.getCellGeometry(a.cell),g=a.view.getState(e.getParent(a.cell));0==b&&0==c||null==f||!f.relative||!e.isVertex(a.cell)||null!=g&&!e.isVertex(g.cell)&&null==this.deltas.get(a.cell)||(a.x+=b,a.y+=c);this.graph.cellRenderer.redraw(a);null!=d&&d(a);f=e.getChildCount(a.cell);for(g=0;g<f;g++)this.revalidateState(this.graph.view.getState(e.getChildAt(a.cell, mxCellStatePreview.prototype.revalidateState=function(a,b,c,d){if(null!=a){var e=this.graph.getModel();e.isEdge(a.cell)&&a.view.updateCellState(a);var f=this.graph.getCellGeometry(a.cell),g=a.view.getState(e.getParent(a.cell));0==b&&0==c||null==f||!f.relative||!e.isVertex(a.cell)||null!=g&&!e.isVertex(g.cell)&&null==this.deltas.get(a.cell)||(a.x+=b,a.y+=c);this.graph.cellRenderer.redraw(a);null!=d&&d(a);f=e.getChildCount(a.cell);for(g=0;g<f;g++)this.revalidateState(this.graph.view.getState(e.getChildAt(a.cell,
g)),b,c,d)}};mxCellStatePreview.prototype.addEdges=function(a){for(var b=this.graph.getModel(),c=b.getEdgeCount(a.cell),d=0;d<c;d++){var e=a.view.getState(b.getEdgeAt(a.cell,d));null!=e&&this.moveState(e,0,0)}};function mxConnectionConstraint(a,b,c,d,e){this.point=a;this.perimeter=null!=b?b:!0;this.name=c;this.dx=d?d:0;this.dy=e?e:0}mxConnectionConstraint.prototype.point=null;mxConnectionConstraint.prototype.perimeter=null;mxConnectionConstraint.prototype.name=null; g)),b,c,d)}};mxCellStatePreview.prototype.addEdges=function(a){for(var b=this.graph.getModel(),c=b.getEdgeCount(a.cell),d=0;d<c;d++){var e=a.view.getState(b.getEdgeAt(a.cell,d));null!=e&&this.moveState(e,0,0)}};function mxConnectionConstraint(a,b,c,d,e){this.point=a;this.perimeter=null!=b?b:!0;this.name=c;this.dx=d?d:0;this.dy=e?e:0}mxConnectionConstraint.prototype.point=null;mxConnectionConstraint.prototype.perimeter=null;mxConnectionConstraint.prototype.name=null;
mxConnectionConstraint.prototype.dx=null;mxConnectionConstraint.prototype.dy=null; mxConnectionConstraint.prototype.dx=null;mxConnectionConstraint.prototype.dy=null;
function mxGraphHandler(a){this.graph=a;this.graph.addMouseListener(this);this.panHandler=mxUtils.bind(this,function(){this.updatePreview();this.updateHint()});this.graph.addListener(mxEvent.PAN,this.panHandler);this.escapeHandler=mxUtils.bind(this,function(a,c){this.reset()});this.graph.addListener(mxEvent.ESCAPE,this.escapeHandler);this.refreshHandler=mxUtils.bind(this,function(a,c){if(null!=this.first)try{this.bounds=this.graph.getView().getBounds(this.cells),this.pBounds=this.getPreviewBounds(this.cells), function mxGraphHandler(a){this.graph=a;this.graph.addMouseListener(this);this.panHandler=mxUtils.bind(this,function(){this.suspended||(this.updatePreview(),this.updateHint())});this.graph.addListener(mxEvent.PAN,this.panHandler);this.escapeHandler=mxUtils.bind(this,function(a,c){this.reset()});this.graph.addListener(mxEvent.ESCAPE,this.escapeHandler);this.refreshHandler=mxUtils.bind(this,function(a,c){if(null!=this.first&&!this.suspended)try{this.bounds=this.graph.getView().getBounds(this.cells),
this.updatePreview(!0),window.setTimeout(mxUtils.bind(this,function(){this.livePreviewUsed&&(this.setHandlesVisibleForCells(this.cells,!1),this.updatePreview())}),0)}catch(d){this.reset()}});this.graph.getModel().addListener(mxEvent.CHANGE,this.refreshHandler)}mxGraphHandler.prototype.graph=null;mxGraphHandler.prototype.maxCells=mxClient.IS_IE?20:50;mxGraphHandler.prototype.enabled=!0;mxGraphHandler.prototype.highlightEnabled=!0;mxGraphHandler.prototype.cloneEnabled=!0; this.pBounds=this.getPreviewBounds(this.cells),this.updatePreview(!0),window.setTimeout(mxUtils.bind(this,function(){this.livePreviewUsed&&(this.setHandlesVisibleForCells(this.cells,!1),this.updatePreview())}),0)}catch(d){this.reset()}});this.graph.getModel().addListener(mxEvent.CHANGE,this.refreshHandler)}mxGraphHandler.prototype.graph=null;mxGraphHandler.prototype.maxCells=mxClient.IS_IE?20:50;mxGraphHandler.prototype.enabled=!0;mxGraphHandler.prototype.highlightEnabled=!0;
mxGraphHandler.prototype.moveEnabled=!0;mxGraphHandler.prototype.guidesEnabled=!1;mxGraphHandler.prototype.guide=null;mxGraphHandler.prototype.currentDx=null;mxGraphHandler.prototype.currentDy=null;mxGraphHandler.prototype.updateCursor=!0;mxGraphHandler.prototype.selectEnabled=!0;mxGraphHandler.prototype.removeCellsFromParent=!0;mxGraphHandler.prototype.removeEmptyParents=!1;mxGraphHandler.prototype.connectOnDrop=!1;mxGraphHandler.prototype.scrollOnMove=!0;mxGraphHandler.prototype.minimumSize=6; mxGraphHandler.prototype.cloneEnabled=!0;mxGraphHandler.prototype.moveEnabled=!0;mxGraphHandler.prototype.guidesEnabled=!1;mxGraphHandler.prototype.guide=null;mxGraphHandler.prototype.currentDx=null;mxGraphHandler.prototype.currentDy=null;mxGraphHandler.prototype.updateCursor=!0;mxGraphHandler.prototype.selectEnabled=!0;mxGraphHandler.prototype.removeCellsFromParent=!0;mxGraphHandler.prototype.removeEmptyParents=!1;mxGraphHandler.prototype.connectOnDrop=!1;mxGraphHandler.prototype.scrollOnMove=!0;
mxGraphHandler.prototype.previewColor="black";mxGraphHandler.prototype.htmlPreview=!1;mxGraphHandler.prototype.shape=null;mxGraphHandler.prototype.scaleGrid=!1;mxGraphHandler.prototype.rotationEnabled=!0;mxGraphHandler.prototype.maxLivePreview=0;mxGraphHandler.prototype.allowLivePreview=mxClient.IS_SVG;mxGraphHandler.prototype.isEnabled=function(){return this.enabled};mxGraphHandler.prototype.setEnabled=function(a){this.enabled=a};mxGraphHandler.prototype.isCloneEnabled=function(){return this.cloneEnabled}; mxGraphHandler.prototype.minimumSize=6;mxGraphHandler.prototype.previewColor="black";mxGraphHandler.prototype.htmlPreview=!1;mxGraphHandler.prototype.shape=null;mxGraphHandler.prototype.scaleGrid=!1;mxGraphHandler.prototype.rotationEnabled=!0;mxGraphHandler.prototype.maxLivePreview=0;mxGraphHandler.prototype.allowLivePreview=mxClient.IS_SVG;mxGraphHandler.prototype.isEnabled=function(){return this.enabled};mxGraphHandler.prototype.setEnabled=function(a){this.enabled=a};
mxGraphHandler.prototype.setCloneEnabled=function(a){this.cloneEnabled=a};mxGraphHandler.prototype.isMoveEnabled=function(){return this.moveEnabled};mxGraphHandler.prototype.setMoveEnabled=function(a){this.moveEnabled=a};mxGraphHandler.prototype.isSelectEnabled=function(){return this.selectEnabled};mxGraphHandler.prototype.setSelectEnabled=function(a){this.selectEnabled=a};mxGraphHandler.prototype.isRemoveCellsFromParent=function(){return this.removeCellsFromParent}; mxGraphHandler.prototype.isCloneEnabled=function(){return this.cloneEnabled};mxGraphHandler.prototype.setCloneEnabled=function(a){this.cloneEnabled=a};mxGraphHandler.prototype.isMoveEnabled=function(){return this.moveEnabled};mxGraphHandler.prototype.setMoveEnabled=function(a){this.moveEnabled=a};mxGraphHandler.prototype.isSelectEnabled=function(){return this.selectEnabled};mxGraphHandler.prototype.setSelectEnabled=function(a){this.selectEnabled=a};
mxGraphHandler.prototype.setRemoveCellsFromParent=function(a){this.removeCellsFromParent=a};mxGraphHandler.prototype.getInitialCellForEvent=function(a){return a.getCell()};mxGraphHandler.prototype.isDelayedSelection=function(a,b){return this.graph.isCellSelected(a)};mxGraphHandler.prototype.consumeMouseEvent=function(a,b){b.consume()}; mxGraphHandler.prototype.isRemoveCellsFromParent=function(){return this.removeCellsFromParent};mxGraphHandler.prototype.setRemoveCellsFromParent=function(a){this.removeCellsFromParent=a};mxGraphHandler.prototype.getInitialCellForEvent=function(a){return a.getCell()};mxGraphHandler.prototype.isDelayedSelection=function(a,b){return this.graph.isCellSelected(a)};mxGraphHandler.prototype.consumeMouseEvent=function(a,b){b.consume()};
mxGraphHandler.prototype.mouseDown=function(a,b){if(!b.isConsumed()&&this.isEnabled()&&this.graph.isEnabled()&&null!=b.getState()&&!mxEvent.isMultiTouchEvent(b.getEvent())){var c=this.getInitialCellForEvent(b);this.delayedSelection=this.isDelayedSelection(c,b);this.cell=null;this.isSelectEnabled()&&!this.delayedSelection&&this.graph.selectCellForEvent(c,b.getEvent());if(this.isMoveEnabled()){var d=this.graph.model,e=d.getGeometry(c);this.graph.isCellMovable(c)&&(!d.isEdge(c)||1<this.graph.getSelectionCount()|| mxGraphHandler.prototype.mouseDown=function(a,b){if(!b.isConsumed()&&this.isEnabled()&&this.graph.isEnabled()&&null!=b.getState()&&!mxEvent.isMultiTouchEvent(b.getEvent())){var c=this.getInitialCellForEvent(b);this.delayedSelection=this.isDelayedSelection(c,b);this.cell=null;this.isSelectEnabled()&&!this.delayedSelection&&this.graph.selectCellForEvent(c,b.getEvent());if(this.isMoveEnabled()){var d=this.graph.model,e=d.getGeometry(c);this.graph.isCellMovable(c)&&(!d.isEdge(c)||1<this.graph.getSelectionCount()||
null!=e.points&&0<e.points.length||null==d.getTerminal(c,!0)||null==d.getTerminal(c,!1)||this.graph.allowDanglingEdges||this.graph.isCloneEvent(b.getEvent())&&this.graph.isCellsCloneable())?this.start(c,b.getX(),b.getY()):this.delayedSelection&&(this.cell=c);this.cellWasClicked=!0;this.consumeMouseEvent(mxEvent.MOUSE_DOWN,b)}}}; null!=e.points&&0<e.points.length||null==d.getTerminal(c,!0)||null==d.getTerminal(c,!1)||this.graph.allowDanglingEdges||this.graph.isCloneEvent(b.getEvent())&&this.graph.isCellsCloneable())?this.start(c,b.getX(),b.getY()):this.delayedSelection&&(this.cell=c);this.cellWasClicked=!0;this.consumeMouseEvent(mxEvent.MOUSE_DOWN,b)}}};
mxGraphHandler.prototype.getGuideStates=function(){var a=this.graph.getDefaultParent(),b=this.graph.getModel(),c=mxUtils.bind(this,function(a){return null!=this.graph.view.getState(a)&&b.isVertex(a)&&null!=b.getGeometry(a)&&!b.getGeometry(a).relative});return this.graph.view.getCellStates(b.filterDescendants(c,a))};mxGraphHandler.prototype.getCells=function(a){return!this.delayedSelection&&this.graph.isCellMovable(a)?[a]:this.graph.getMovableCells(this.graph.getSelectionCells())}; mxGraphHandler.prototype.getGuideStates=function(){var a=this.graph.getDefaultParent(),b=this.graph.getModel(),c=mxUtils.bind(this,function(a){return null!=this.graph.view.getState(a)&&b.isVertex(a)&&null!=b.getGeometry(a)&&!b.getGeometry(a).relative});return this.graph.view.getCellStates(b.filterDescendants(c,a))};mxGraphHandler.prototype.getCells=function(a){return!this.delayedSelection&&this.graph.isCellMovable(a)?[a]:this.graph.getMovableCells(this.graph.getSelectionCells())};
mxGraphHandler.prototype.getPreviewBounds=function(a){a=this.getBoundingBox(a);null!=a&&(a.width=Math.max(0,a.width-1),a.height=Math.max(0,a.height-1),a.width<this.minimumSize?(a.x-=(this.minimumSize-a.width)/2,a.width=this.minimumSize):(a.x=Math.round(a.x),a.width=Math.ceil(a.width)),a.height<this.minimumSize?(a.y-=(this.minimumSize-a.height)/2,a.height=this.minimumSize):(a.y=Math.round(a.y),a.height=Math.ceil(a.height)));return a}; mxGraphHandler.prototype.getPreviewBounds=function(a){a=this.getBoundingBox(a);null!=a&&(a.width=Math.max(0,a.width-1),a.height=Math.max(0,a.height-1),a.width<this.minimumSize?(a.x-=(this.minimumSize-a.width)/2,a.width=this.minimumSize):(a.x=Math.round(a.x),a.width=Math.ceil(a.width)),a.height<this.minimumSize?(a.y-=(this.minimumSize-a.height)/2,a.height=this.minimumSize):(a.y=Math.round(a.y),a.height=Math.ceil(a.height)));return a};
mxGraphHandler.prototype.getBoundingBox=function(a){var b=null;if(null!=a&&0<a.length)for(var c=this.graph.getModel(),d=0;d<a.length;d++)if(c.isVertex(a[d])||c.isEdge(a[d])){var e=this.graph.view.getState(a[d]);if(null!=e){var f=e;c.isVertex(a[d])&&null!=e.shape&&null!=e.shape.boundingBox&&(f=e.shape.boundingBox);null==b?b=mxRectangle.fromRectangle(f):b.add(f)}}return b}; mxGraphHandler.prototype.getBoundingBox=function(a){var b=null;if(null!=a&&0<a.length)for(var c=this.graph.getModel(),d=0;d<a.length;d++)if(c.isVertex(a[d])||c.isEdge(a[d])){var e=this.graph.view.getState(a[d]);if(null!=e){var f=e;c.isVertex(a[d])&&null!=e.shape&&null!=e.shape.boundingBox&&(f=e.shape.boundingBox);null==b?b=mxRectangle.fromRectangle(f):b.add(f)}}return b};
mxGraphHandler.prototype.createPreviewShape=function(a){a=new mxRectangleShape(a,null,this.previewColor);a.isDashed=!0;this.htmlPreview?(a.dialect=mxConstants.DIALECT_STRICTHTML,a.init(this.graph.container)):(a.dialect=this.graph.dialect!=mxConstants.DIALECT_SVG?mxConstants.DIALECT_VML:mxConstants.DIALECT_SVG,a.init(this.graph.getView().getOverlayPane()),a.pointerEvents=!1,mxClient.IS_IOS&&(a.getSvgScreenOffset=function(){return 0}));return a}; mxGraphHandler.prototype.createPreviewShape=function(a){a=new mxRectangleShape(a,null,this.previewColor);a.isDashed=!0;this.htmlPreview?(a.dialect=mxConstants.DIALECT_STRICTHTML,a.init(this.graph.container)):(a.dialect=this.graph.dialect!=mxConstants.DIALECT_SVG?mxConstants.DIALECT_VML:mxConstants.DIALECT_SVG,a.init(this.graph.getView().getOverlayPane()),a.pointerEvents=!1,mxClient.IS_IOS&&(a.getSvgScreenOffset=function(){return 0}));return a};
mxGraphHandler.prototype.start=function(a,b,c){this.cell=a;this.first=mxUtils.convertPoint(this.graph.container,b,c);this.cells=this.getCells(this.cell);this.bounds=this.graph.getView().getBounds(this.cells);this.pBounds=this.getPreviewBounds(this.cells);this.allCells=new mxDictionary;this.cloning=!1;for(b=this.cellCount=0;b<this.cells.length;b++)this.cellCount+=this.addStates(this.cells[b],this.allCells);if(this.guidesEnabled){this.guide=new mxGuide(this.graph,this.getGuideStates());var d=this.graph.model.getParent(a), mxGraphHandler.prototype.start=function(a,b,c,d){this.cell=a;this.first=mxUtils.convertPoint(this.graph.container,b,c);this.cells=null!=d?d:this.getCells(this.cell);this.bounds=this.graph.getView().getBounds(this.cells);this.pBounds=this.getPreviewBounds(this.cells);this.allCells=new mxDictionary;this.cloning=!1;for(b=this.cellCount=0;b<this.cells.length;b++)this.cellCount+=this.addStates(this.cells[b],this.allCells);if(this.guidesEnabled){this.guide=new mxGuide(this.graph,this.getGuideStates());
e=2>this.graph.model.getChildCount(d);this.guide.isStateIgnored=mxUtils.bind(this,function(a){var b=this.graph.model.getParent(a.cell);return null!=a.cell&&(!this.cloning&&this.isCellMoving(a.cell)||a.cell!=(this.target||d)&&!e&&(null==this.target||2<=this.graph.model.getChildCount(this.target))&&b!=(this.target||d))})}}; var e=this.graph.model.getParent(a),f=2>this.graph.model.getChildCount(e);this.guide.isStateIgnored=mxUtils.bind(this,function(a){var b=this.graph.model.getParent(a.cell);return null!=a.cell&&(!this.cloning&&this.isCellMoving(a.cell)||a.cell!=(this.target||e)&&!f&&(null==this.target||2<=this.graph.model.getChildCount(this.target))&&b!=(this.target||e))})}};
mxGraphHandler.prototype.addStates=function(a,b){var c=this.graph.view.getState(a),d=0;if(null!=c&&null==b.get(a)){b.put(a,c);d++;for(var c=this.graph.model.getChildCount(a),e=0;e<c;e++)d+=this.addStates(this.graph.model.getChildAt(a,e),b)}return d};mxGraphHandler.prototype.isCellMoving=function(a){return null!=this.allCells.get(a)};mxGraphHandler.prototype.useGuidesForEvent=function(a){return null!=this.guide?this.guide.isEnabledForEvent(a.getEvent()):!0}; mxGraphHandler.prototype.addStates=function(a,b){var c=this.graph.view.getState(a),d=0;if(null!=c&&null==b.get(a)){b.put(a,c);d++;for(var c=this.graph.model.getChildCount(a),e=0;e<c;e++)d+=this.addStates(this.graph.model.getChildAt(a,e),b)}return d};mxGraphHandler.prototype.isCellMoving=function(a){return null!=this.allCells.get(a)};mxGraphHandler.prototype.useGuidesForEvent=function(a){return null!=this.guide?this.guide.isEnabledForEvent(a.getEvent()):!0};
mxGraphHandler.prototype.snap=function(a){var b=this.scaleGrid?this.graph.view.scale:1;a.x=this.graph.snap(a.x/b)*b;a.y=this.graph.snap(a.y/b)*b;return a};mxGraphHandler.prototype.getDelta=function(a){a=mxUtils.convertPoint(this.graph.container,a.getX(),a.getY());var b=this.graph.view.scale;return new mxPoint(this.roundLength((a.x-this.first.x-this.graph.panDx)/b)*b,this.roundLength((a.y-this.first.y-this.graph.panDy)/b)*b)};mxGraphHandler.prototype.updateHint=function(a){}; mxGraphHandler.prototype.snap=function(a){var b=this.scaleGrid?this.graph.view.scale:1;a.x=this.graph.snap(a.x/b)*b;a.y=this.graph.snap(a.y/b)*b;return a};mxGraphHandler.prototype.getDelta=function(a){a=mxUtils.convertPoint(this.graph.container,a.getX(),a.getY());var b=this.graph.view.scale;return new mxPoint(this.roundLength((a.x-this.first.x-this.graph.panDx)/b)*b,this.roundLength((a.y-this.first.y-this.graph.panDy)/b)*b)};mxGraphHandler.prototype.updateHint=function(a){};
mxGraphHandler.prototype.removeHint=function(){};mxGraphHandler.prototype.roundLength=function(a){return Math.round(2*a)/2}; mxGraphHandler.prototype.removeHint=function(){};mxGraphHandler.prototype.roundLength=function(a){return Math.round(2*a)/2};
mxGraphHandler.prototype.mouseMove=function(a,b){var c=this.graph;if(!b.isConsumed()&&c.isMouseDown&&null!=this.cell&&null!=this.first&&null!=this.bounds)if(mxEvent.isMultiTouchEvent(b.getEvent()))this.reset();else{var d=this.getDelta(b),e=d.x,d=d.y,f=c.tolerance;if(null!=this.shape||this.livePreviewActive||Math.abs(e)>f||Math.abs(d)>f){null==this.highlight&&(this.highlight=new mxCellHighlight(this.graph,mxConstants.DROP_TARGET_COLOR,3));var g=c.isCloneEvent(b.getEvent())&&c.isCellsCloneable()&&this.isCloneEnabled(), mxGraphHandler.prototype.mouseMove=function(a,b){var c=this.graph;if(b.isConsumed()||!c.isMouseDown||null==this.cell||null==this.first||null==this.bounds||this.suspended)!this.isMoveEnabled()&&!this.isCloneEnabled()||!this.updateCursor||b.isConsumed()||null==b.getState()&&null==b.sourceState||c.isMouseDown||(e=c.getCursorForMouseEvent(b),null==e&&c.isEnabled()&&c.isCellMovable(b.getCell())&&(e=c.getModel().isEdge(b.getCell())?mxConstants.CURSOR_MOVABLE_EDGE:mxConstants.CURSOR_MOVABLE_VERTEX),null!=
k=c.isGridEnabledEvent(b.getEvent()),l=b.getCell(),f=!0,m=null;this.cloning=g;c.isDropEnabled()&&this.highlightEnabled&&(m=c.getDropTarget(this.cells,b.getEvent(),l,g));var n=c.getView().getState(m),p=!1;null==n||c.model.getParent(this.cell)==m&&!g?(this.target=null,this.connectOnDrop&&null!=l&&1==this.cells.length&&c.getModel().isVertex(l)&&c.isCellConnectable(l)&&(n=c.getView().getState(l),null!=n&&(l=null==c.getEdgeValidationError(null,this.cell,l)?mxConstants.VALID_COLOR:mxConstants.INVALID_CONNECT_TARGET_COLOR, e&&null!=b.sourceState&&b.sourceState.setCursor(e));else if(mxEvent.isMultiTouchEvent(b.getEvent()))this.reset();else{var d=this.getDelta(b),e=d.x,d=d.y,f=c.tolerance;if(null!=this.shape||this.livePreviewActive||Math.abs(e)>f||Math.abs(d)>f){null==this.highlight&&(this.highlight=new mxCellHighlight(this.graph,mxConstants.DROP_TARGET_COLOR,3));var g=c.isCloneEvent(b.getEvent())&&c.isCellsCloneable()&&this.isCloneEnabled(),k=c.isGridEnabledEvent(b.getEvent()),l=b.getCell(),f=!0,m=null;this.cloning=
this.setHighlightColor(l),p=!0))):(this.target!=m&&(this.target=m,this.setHighlightColor(mxConstants.DROP_TARGET_COLOR)),p=!0);null!=n&&p?this.highlight.highlight(n):this.highlight.hide();this.livePreviewActive&&g?(this.resetLivePreview(),this.livePreviewActive=!1):this.maxLivePreview>=this.cellCount&&!this.livePreviewActive&&this.allowLivePreview?(this.setHandlesVisibleForCells(this.cells,!1),this.livePreviewUsed=this.livePreviewActive=!0):this.livePreviewUsed||null!=this.shape||(this.shape=this.createPreviewShape(this.bounds)); g;c.isDropEnabled()&&this.highlightEnabled&&(m=c.getDropTarget(this.cells,b.getEvent(),l,g));var n=c.getView().getState(m),p=!1;null==n||c.model.getParent(this.cell)==m&&!g?(this.target=null,this.connectOnDrop&&null!=l&&1==this.cells.length&&c.getModel().isVertex(l)&&c.isCellConnectable(l)&&(n=c.getView().getState(l),null!=n&&(l=null==c.getEdgeValidationError(null,this.cell,l)?mxConstants.VALID_COLOR:mxConstants.INVALID_CONNECT_TARGET_COLOR,this.setHighlightColor(l),p=!0))):(this.target!=m&&(this.target=
null!=this.guide&&this.useGuidesForEvent(b)?(d=this.guide.move(this.bounds,new mxPoint(e,d),k,g),f=!1,e=d.x,d=d.y):k&&(k=c.getView().translate,n=c.getView().scale,g=this.bounds.x-(c.snap(this.bounds.x/n-k.x)+k.x)*n,k=this.bounds.y-(c.snap(this.bounds.y/n-k.y)+k.y)*n,d=this.snap(new mxPoint(e,d)),e=d.x-g,d=d.y-k);null!=this.guide&&f&&this.guide.hide();c.isConstrainedEvent(b.getEvent())&&(Math.abs(e)>Math.abs(d)?d=0:e=0);this.currentDx=e;this.currentDy=d;this.updatePreview()}this.updateHint(b);this.consumeMouseEvent(mxEvent.MOUSE_MOVE, m,this.setHighlightColor(mxConstants.DROP_TARGET_COLOR)),p=!0);null!=n&&p?this.highlight.highlight(n):this.highlight.hide();this.livePreviewActive&&g?(this.resetLivePreview(),this.livePreviewActive=!1):this.maxLivePreview>=this.cellCount&&!this.livePreviewActive&&this.allowLivePreview?g||(this.setHandlesVisibleForCells(this.cells,!1),this.livePreviewUsed=this.livePreviewActive=!0):this.livePreviewUsed||null!=this.shape||(this.shape=this.createPreviewShape(this.bounds));null!=this.guide&&this.useGuidesForEvent(b)?
b);mxEvent.consume(b.getEvent())}else!this.isMoveEnabled()&&!this.isCloneEnabled()||!this.updateCursor||b.isConsumed()||null==b.getState()&&null==b.sourceState||c.isMouseDown||(e=c.getCursorForMouseEvent(b),null==e&&c.isEnabled()&&c.isCellMovable(b.getCell())&&(e=c.getModel().isEdge(b.getCell())?mxConstants.CURSOR_MOVABLE_EDGE:mxConstants.CURSOR_MOVABLE_VERTEX),null!=e&&null!=b.sourceState&&b.sourceState.setCursor(e))}; (d=this.guide.move(this.bounds,new mxPoint(e,d),k,g),f=!1,e=d.x,d=d.y):k&&(k=c.getView().translate,n=c.getView().scale,g=this.bounds.x-(c.snap(this.bounds.x/n-k.x)+k.x)*n,k=this.bounds.y-(c.snap(this.bounds.y/n-k.y)+k.y)*n,d=this.snap(new mxPoint(e,d)),e=d.x-g,d=d.y-k);null!=this.guide&&f&&this.guide.hide();c.isConstrainedEvent(b.getEvent())&&(Math.abs(e)>Math.abs(d)?d=0:e=0);this.currentDx=e;this.currentDy=d;this.updatePreview()}this.updateHint(b);this.consumeMouseEvent(mxEvent.MOUSE_MOVE,b);mxEvent.consume(b.getEvent())}};
mxGraphHandler.prototype.updatePreview=function(a){this.livePreviewUsed&&!a?null!=this.cells&&this.updateLivePreview(this.currentDx,this.currentDy):this.updatePreviewShape()};mxGraphHandler.prototype.updatePreviewShape=function(){null!=this.shape&&(this.shape.bounds=new mxRectangle(Math.round(this.pBounds.x+this.currentDx),Math.round(this.pBounds.y+this.currentDy),this.pBounds.width,this.pBounds.height),this.shape.redraw())}; mxGraphHandler.prototype.updatePreview=function(a){this.livePreviewUsed&&!a?null!=this.cells&&this.updateLivePreview(this.currentDx,this.currentDy):this.updatePreviewShape()};mxGraphHandler.prototype.updatePreviewShape=function(){null!=this.shape&&(this.shape.bounds=new mxRectangle(Math.round(this.pBounds.x+this.currentDx),Math.round(this.pBounds.y+this.currentDy),this.pBounds.width,this.pBounds.height),this.shape.redraw())};
mxGraphHandler.prototype.updateLivePreview=function(a,b){var c=[];null!=this.allCells&&this.allCells.visit(mxUtils.bind(this,function(d,e){var f=e.clone();c.push([e,f]);null!=e.shape&&(null==e.shape.originalPointerEvents&&(e.shape.originalPointerEvents=e.shape.pointerEvents),e.shape.pointerEvents=!1,null!=e.text&&null!=e.text.node&&(f=e.text.node,null!=f.firstChild&&null!=f.firstChild.firstChild&&"foreignObject"==f.firstChild.firstChild.nodeName?f.firstChild.firstChild.setAttribute("pointer-events", mxGraphHandler.prototype.updateLivePreview=function(a,b){if(!this.suspended){var c=[];null!=this.allCells&&this.allCells.visit(mxUtils.bind(this,function(d,e){var f=e.clone();c.push([e,f]);null!=e.shape&&(null==e.shape.originalPointerEvents&&(e.shape.originalPointerEvents=e.shape.pointerEvents),e.shape.pointerEvents=!1,null!=e.text&&null!=e.text.node&&(f=e.text.node,null!=f.firstChild&&null!=f.firstChild.firstChild&&"foreignObject"==f.firstChild.firstChild.nodeName?f.firstChild.firstChild.setAttribute("pointer-events",
"none"):null!=f.ownerSVGElement?f.setAttribute("pointer-events","none"):f.style.pointerEvents="none"));this.graph.model.isVertex(e.cell)&&(e.x+=a,e.y+=b,this.cloning||(e.view.graph.cellRenderer.redraw(e,!0),e.view.invalidate(e.cell),e.invalid=!1),null!=e.control&&null!=e.control.node&&(e.control.node.style.visibility="hidden"))}));for(var d=this.graph.view.scale,e=0;e<c.length;e++){var f=c[e][0];if(this.graph.model.isEdge(f.cell)){var g=this.graph.getCellGeometry(f.cell),k=[];if(null!=g&&null!=g.points)for(var l= "none"):null!=f.ownerSVGElement?f.setAttribute("pointer-events","none"):f.style.pointerEvents="none"));this.graph.model.isVertex(e.cell)&&(e.x+=a,e.y+=b,this.cloning||(e.view.graph.cellRenderer.redraw(e,!0),e.view.invalidate(e.cell),e.invalid=!1),null!=e.control&&null!=e.control.node&&(e.control.node.style.visibility="hidden"))}));for(var d=this.graph.view.scale,e=0;e<c.length;e++){var f=c[e][0];if(this.graph.model.isEdge(f.cell)){var g=this.graph.getCellGeometry(f.cell),k=[];if(null!=g&&null!=g.points)for(var l=
0;l<g.points.length;l++)null!=g.points[l]&&k.push(new mxPoint(g.points[l].x+a/d,g.points[l].y+b/d));var g=f.visibleSourceState,l=f.visibleTargetState,m=c[e][1].absolutePoints;null!=g&&this.isCellMoving(g.cell)?f.view.updateFixedTerminalPoint(f,g,!0,this.graph.getConnectionConstraint(f,g,!0)):(g=m[0],f.setAbsoluteTerminalPoint(new mxPoint(g.x+a,g.y+b),!0),g=null);null!=l&&this.isCellMoving(l.cell)?f.view.updateFixedTerminalPoint(f,l,!1,this.graph.getConnectionConstraint(f,l,!1)):(l=m[m.length-1],f.setAbsoluteTerminalPoint(new mxPoint(l.x+ 0;l<g.points.length;l++)null!=g.points[l]&&k.push(new mxPoint(g.points[l].x+a/d,g.points[l].y+b/d));var g=f.visibleSourceState,l=f.visibleTargetState,m=c[e][1].absolutePoints;null!=g&&this.isCellMoving(g.cell)?f.view.updateFixedTerminalPoint(f,g,!0,this.graph.getConnectionConstraint(f,g,!0)):(g=m[0],f.setAbsoluteTerminalPoint(new mxPoint(g.x+a,g.y+b),!0),g=null);null!=l&&this.isCellMoving(l.cell)?f.view.updateFixedTerminalPoint(f,l,!1,this.graph.getConnectionConstraint(f,l,!1)):(l=m[m.length-1],f.setAbsoluteTerminalPoint(new mxPoint(l.x+
a,l.y+b),!1),l=null);f.view.updatePoints(f,k,g,l);f.view.updateFloatingTerminalPoints(f,g,l);f.invalid=!1;this.cloning||f.view.graph.cellRenderer.redraw(f,!0)}}this.graph.view.validate();this.redrawHandles(c);this.resetPreviewStates(c)};mxGraphHandler.prototype.redrawHandles=function(a){for(var b=0;b<a.length;b++){var c=this.graph.selectionCellsHandler.getHandler(a[b][0].cell);null!=c&&c.redraw(!0)}};mxGraphHandler.prototype.resetPreviewStates=function(a){for(var b=0;b<a.length;b++)a[b][0].setState(a[b][1])}; a,l.y+b),!1),l=null);f.view.updatePoints(f,k,g,l);f.view.updateFloatingTerminalPoints(f,g,l);f.invalid=!1;this.cloning||f.view.graph.cellRenderer.redraw(f,!0)}}this.graph.view.validate();this.redrawHandles(c);this.resetPreviewStates(c)}};mxGraphHandler.prototype.redrawHandles=function(a){for(var b=0;b<a.length;b++){var c=this.graph.selectionCellsHandler.getHandler(a[b][0].cell);null!=c&&c.redraw(!0)}};mxGraphHandler.prototype.resetPreviewStates=function(a){for(var b=0;b<a.length;b++)a[b][0].setState(a[b][1])};
mxGraphHandler.prototype.suspend=function(){this.suspended||(this.livePreviewUsed&&this.updateLivePreview(0,0),null!=this.shape&&(this.shape.node.style.visibility="hidden"),null!=this.guide&&this.guide.setVisible(!1),this.suspended=!0)};mxGraphHandler.prototype.resume=function(){this.suspended&&(this.suspended=null,this.livePreviewUsed&&(this.livePreviewActive=!0),null!=this.shape&&(this.shape.node.style.visibility="visible"),null!=this.guide&&this.guide.setVisible(!0))};
mxGraphHandler.prototype.resetLivePreview=function(){null!=this.allCells&&(this.allCells.visit(mxUtils.bind(this,function(a,b){if(null!=b.shape&&null!=b.shape.originalPointerEvents&&(b.shape.pointerEvents=b.shape.originalPointerEvents,b.shape.originalPointerEvents=null,b.shape.bounds=null,null!=b.text&&null!=b.text.node)){var c=b.text.node;null!=c.firstChild&&null!=c.firstChild.firstChild&&"foreignObject"==c.firstChild.firstChild.nodeName?c.firstChild.firstChild.setAttribute("pointer-events","all"): mxGraphHandler.prototype.resetLivePreview=function(){null!=this.allCells&&(this.allCells.visit(mxUtils.bind(this,function(a,b){if(null!=b.shape&&null!=b.shape.originalPointerEvents&&(b.shape.pointerEvents=b.shape.originalPointerEvents,b.shape.originalPointerEvents=null,b.shape.bounds=null,null!=b.text&&null!=b.text.node)){var c=b.text.node;null!=c.firstChild&&null!=c.firstChild.firstChild&&"foreignObject"==c.firstChild.firstChild.nodeName?c.firstChild.firstChild.setAttribute("pointer-events","all"):
null!=c.ownerSVGElement?c.removeAttribute("pointer-events"):c.style.pointerEvents=""}null!=b.control&&null!=b.control.node&&(b.control.node.style.visibility="");b.view.invalidate(b.cell)})),this.graph.view.validate())};mxGraphHandler.prototype.setHandlesVisibleForCells=function(a,b){for(var c=0;c<a.length;c++){var d=this.graph.selectionCellsHandler.getHandler(a[c]);null!=d&&(d.setHandlesVisible(b),b&&d.redraw())}};mxGraphHandler.prototype.setHighlightColor=function(a){null!=this.highlight&&this.highlight.setHighlightColor(a)}; null!=c.ownerSVGElement?c.removeAttribute("pointer-events"):c.style.pointerEvents=""}null!=b.control&&null!=b.control.node&&(b.control.node.style.visibility="");b.view.invalidate(b.cell)})),this.graph.view.validate())};mxGraphHandler.prototype.setHandlesVisibleForCells=function(a,b){for(var c=0;c<a.length;c++){var d=this.graph.selectionCellsHandler.getHandler(a[c]);null!=d&&(d.setHandlesVisible(b),b&&d.redraw())}};mxGraphHandler.prototype.setHighlightColor=function(a){null!=this.highlight&&this.highlight.setHighlightColor(a)};
mxGraphHandler.prototype.mouseUp=function(a,b){if(!b.isConsumed())if(this.livePreviewUsed&&this.resetLivePreview(),null==this.cell||null==this.first||null==this.shape&&!this.livePreviewUsed||null==this.currentDx||null==this.currentDy)this.isSelectEnabled()&&this.delayedSelection&&null!=this.cell&&this.selectDelayed(b);else{var c=this.graph,d=b.getCell();if(this.connectOnDrop&&null==this.target&&null!=d&&c.getModel().isVertex(d)&&c.isCellConnectable(d)&&c.isEdgeValid(null,this.cell,d))c.connectionHandler.connect(this.cell, mxGraphHandler.prototype.mouseUp=function(a,b){if(!b.isConsumed())if(this.livePreviewUsed&&this.resetLivePreview(),null==this.cell||null==this.first||null==this.shape&&!this.livePreviewUsed||null==this.currentDx||null==this.currentDy)this.isSelectEnabled()&&this.delayedSelection&&null!=this.cell&&this.selectDelayed(b);else{var c=this.graph,d=b.getCell();if(this.connectOnDrop&&null==this.target&&null!=d&&c.getModel().isVertex(d)&&c.isCellConnectable(d)&&c.isEdgeValid(null,this.cell,d))c.connectionHandler.connect(this.cell,
d,b.getEvent());else{var d=c.isCloneEvent(b.getEvent())&&c.isCellsCloneable()&&this.isCloneEnabled(),e=c.getView().scale,f=this.roundLength(this.currentDx/e),e=this.roundLength(this.currentDy/e),g=this.target;c.isSplitEnabled()&&c.isSplitTarget(g,this.cells,b.getEvent())?c.splitEdge(g,this.cells,null,f,e):this.moveCells(this.cells,f,e,d,this.target,b.getEvent())}}this.cellWasClicked&&this.consumeMouseEvent(mxEvent.MOUSE_UP,b);this.reset()}; d,b.getEvent());else{var d=c.isCloneEvent(b.getEvent())&&c.isCellsCloneable()&&this.isCloneEnabled(),e=c.getView().scale,f=this.roundLength(this.currentDx/e),e=this.roundLength(this.currentDy/e),g=this.target;c.isSplitEnabled()&&c.isSplitTarget(g,this.cells,b.getEvent())?c.splitEdge(g,this.cells,null,f,e):this.moveCells(this.cells,f,e,d,this.target,b.getEvent())}}this.cellWasClicked&&this.consumeMouseEvent(mxEvent.MOUSE_UP,b);this.reset()};
mxGraphHandler.prototype.selectDelayed=function(a){this.graph.isCellSelected(this.cell)&&this.graph.popupMenuHandler.isPopupTrigger(a)||this.graph.selectCellForEvent(this.cell,a.getEvent())}; mxGraphHandler.prototype.selectDelayed=function(a){this.graph.isCellSelected(this.cell)&&this.graph.popupMenuHandler.isPopupTrigger(a)||this.graph.selectCellForEvent(this.cell,a.getEvent())};
mxGraphHandler.prototype.reset=function(){this.livePreviewUsed&&(this.resetLivePreview(),this.setHandlesVisibleForCells(this.cells,!0));this.destroyShapes();this.removeHint();this.delayedSelection=!1;this.livePreviewUsed=this.livePreviewActive=null;this.cellWasClicked=!1;this.cellCount=this.currentDy=this.currentDx=null;this.cloning=!1;this.cell=this.cells=this.first=this.target=this.guides=this.allCells=null}; mxGraphHandler.prototype.reset=function(){this.livePreviewUsed&&(this.resetLivePreview(),this.setHandlesVisibleForCells(this.cells,!0));this.destroyShapes();this.removeHint();this.delayedSelection=!1;this.livePreviewUsed=this.livePreviewActive=null;this.cellWasClicked=!1;this.cellCount=this.currentDy=this.currentDx=this.suspended=null;this.cloning=!1;this.cell=this.cells=this.first=this.target=this.guides=this.pBounds=this.allCells=null};
mxGraphHandler.prototype.shouldRemoveCellsFromParent=function(a,b,c){if(this.graph.getModel().isVertex(a)&&(a=this.graph.getView().getState(a),null!=a)){c=mxUtils.convertPoint(this.graph.container,mxEvent.getClientX(c),mxEvent.getClientY(c));var d=mxUtils.toRadians(mxUtils.getValue(a.style,mxConstants.STYLE_ROTATION)||0);if(0!=d){b=Math.cos(-d);var d=Math.sin(-d),e=new mxPoint(a.getCenterX(),a.getCenterY());c=mxUtils.getRotatedPoint(c,b,d,e)}return!mxUtils.contains(a,c.x,c.y)}return!1}; mxGraphHandler.prototype.shouldRemoveCellsFromParent=function(a,b,c){if(this.graph.getModel().isVertex(a)&&(a=this.graph.getView().getState(a),null!=a)){c=mxUtils.convertPoint(this.graph.container,mxEvent.getClientX(c),mxEvent.getClientY(c));var d=mxUtils.toRadians(mxUtils.getValue(a.style,mxConstants.STYLE_ROTATION)||0);if(0!=d){b=Math.cos(-d);var d=Math.sin(-d),e=new mxPoint(a.getCenterX(),a.getCenterY());c=mxUtils.getRotatedPoint(c,b,d,e)}return!mxUtils.contains(a,c.x,c.y)}return!1};
mxGraphHandler.prototype.moveCells=function(a,b,c,d,e,f){d&&(a=this.graph.getCloneableCells(a));var g=this.graph.getModel().getParent(this.cell);null==e&&this.isRemoveCellsFromParent()&&this.shouldRemoveCellsFromParent(g,a,f)&&(e=this.graph.getDefaultParent());d=d&&!this.graph.isCellLocked(e||this.graph.getDefaultParent());this.graph.getModel().beginUpdate();try{g=[];if(!d&&null!=e&&this.removeEmptyParents){for(var k=new mxDictionary,l=0;l<a.length;l++)k.put(a[l],!0);for(l=0;l<a.length;l++){var m= mxGraphHandler.prototype.moveCells=function(a,b,c,d,e,f){d&&(a=this.graph.getCloneableCells(a));var g=this.graph.getModel().getParent(this.cell);null==e&&this.isRemoveCellsFromParent()&&this.shouldRemoveCellsFromParent(g,a,f)&&(e=this.graph.getDefaultParent());d=d&&!this.graph.isCellLocked(e||this.graph.getDefaultParent());this.graph.getModel().beginUpdate();try{g=[];if(!d&&null!=e&&this.removeEmptyParents){for(var k=new mxDictionary,l=0;l<a.length;l++)k.put(a[l],!0);for(l=0;l<a.length;l++){var m=
this.graph.model.getParent(a[l]);null==m||k.get(m)||(k.put(m,!0),g.push(m))}}a=this.graph.moveCells(a,b,c,d,e,f);b=[];for(l=0;l<g.length;l++)this.shouldRemoveParent(g[l])&&b.push(g[l]);this.graph.removeCells(b,!1)}finally{this.graph.getModel().endUpdate()}d&&this.graph.setSelectionCells(a);this.isSelectEnabled()&&this.scrollOnMove&&this.graph.scrollCellToVisible(a[0])}; this.graph.model.getParent(a[l]);null==m||k.get(m)||(k.put(m,!0),g.push(m))}}a=this.graph.moveCells(a,b,c,d,e,f);b=[];for(l=0;l<g.length;l++)this.shouldRemoveParent(g[l])&&b.push(g[l]);this.graph.removeCells(b,!1)}finally{this.graph.getModel().endUpdate()}d&&this.graph.setSelectionCells(a);this.isSelectEnabled()&&this.scrollOnMove&&this.graph.scrollCellToVisible(a[0])};

View file

@ -1,7 +1,7 @@
CACHE MANIFEST CACHE MANIFEST
# THIS FILE WAS GENERATED. DO NOT MODIFY! # THIS FILE WAS GENERATED. DO NOT MODIFY!
# 12/09/2019 05:11 PM # 12/12/2019 12:26 PM
app.html app.html
index.html?offline=1 index.html?offline=1

File diff suppressed because one or more lines are too long

View file

@ -805,7 +805,7 @@ App.main = function(callback, createUi)
*/ */
if (urlParams['chrome'] != '0' && urlParams['test'] == '1') if (urlParams['chrome'] != '0' && urlParams['test'] == '1')
{ {
EditorUi.debug('Started in ' + (new Date().getTime() - t0.getTime()) + 'ms'); EditorUi.debug('App.start', [ui, (new Date().getTime() - t0.getTime()) + 'ms']);
if (urlParams['export'] != null) if (urlParams['export'] != null)
{ {
@ -2375,13 +2375,42 @@ App.prototype.appIconClicked = function(evt)
this.openLink('https://drive.google.com/?authuser=0'); this.openLink('https://drive.google.com/?authuser=0');
} }
} }
else if (mode == App.MODE_DROPBOX)
{
this.openLink('https://www.dropbox.com/');
}
else if (mode == App.MODE_ONEDRIVE) else if (mode == App.MODE_ONEDRIVE)
{ {
this.openLink('https://onedrive.live.com/'); if (file != null && file.meta != null && file.meta.webUrl != null)
{
var url = file.meta.webUrl;
var name = encodeURIComponent(file.meta.name);
if (url.substring(url.length - name.length, url.length) == name)
{
url = url.substring(0, url.length - name.length);
}
this.openLink(url);
}
else
{
this.openLink('https://onedrive.live.com/');
}
}
else if (mode == App.MODE_DROPBOX)
{
if (file != null && file.stat != null && file.stat.path_display != null)
{
var url = 'https://www.dropbox.com/home/Apps/drawio' + file.stat.path_display;
if (!mxEvent.isShiftDown(evt))
{
url = url.substring(0, url.length - file.stat.name.length);
}
this.openLink(url);
}
else
{
this.openLink('https://www.dropbox.com/');
}
} }
else if (mode == App.MODE_TRELLO) else if (mode == App.MODE_TRELLO)
{ {

View file

@ -261,7 +261,7 @@ DrawioFileSync.prototype.start = function()
{ {
this.pusher.connect(); this.pusher.connect();
this.channel = this.pusher.subscribe(this.channelId); this.channel = this.pusher.subscribe(this.channelId);
EditorUi.debug('Sync.start', 'v' + DrawioFileSync.PROTOCOL, [this]); EditorUi.debug('Sync.start', [this, 'v' + DrawioFileSync.PROTOCOL]);
} }
catch (e) catch (e)
{ {

View file

@ -151,6 +151,11 @@ DriveClient.prototype.lastTokenRefresh = 0;
*/ */
DriveClient.prototype.maxRetries = 5; DriveClient.prototype.maxRetries = 5;
/**
* Executes the first step for connecting to Google Drive.
*/
DriveClient.prototype.staleEtagMaxRetries = 3;
/** /**
* Executes the first step for connecting to Google Drive. * Executes the first step for connecting to Google Drive.
*/ */
@ -1227,6 +1232,7 @@ DriveClient.prototype.saveFile = function(file, revision, success, errFn, noChec
new Date().toISOString() + ':' + new Date().toISOString() + ':' +
'\n\nBrowser=' + navigator.userAgent + '\n\nBrowser=' + navigator.userAgent +
'\nFile=' + file.desc.id + '.' + file.desc.headRevisionId + '\nFile=' + file.desc.id + '.' + file.desc.headRevisionId +
'\nMime=' + file.desc.mimeType +
'\nUser=' + ((this.user != null) ? this.user.id : 'nouser') + '\nUser=' + ((this.user != null) ? this.user.id : 'nouser') +
((file.sync != null) ? '-client_' + file.sync.clientId : '-nosync') + ((file.sync != null) ? '-client_' + file.sync.clientId : '-nosync') +
'\nSaveLevel=' + file.saveLevel + '\nSaveLevel=' + file.saveLevel +
@ -1513,8 +1519,7 @@ DriveClient.prototype.saveFile = function(file, revision, success, errFn, noChec
} }
else else
{ {
// Check for stale etag which can happen if a file is being saved or if // Workaround for correct etag and Google always returns 412 conflict error (stale etag)
// the etag simply isn't change but system still returns a 412 error (stale)
this.executeRequest({ this.executeRequest({
url: '/files/' + file.getId() + '?supportsTeamDrives=true&fields=' + this.catchupFields url: '/files/' + file.getId() + '?supportsTeamDrives=true&fields=' + this.catchupFields
}, },
@ -1527,12 +1532,19 @@ DriveClient.prototype.saveFile = function(file, revision, success, errFn, noChec
// Stale etag detected, retry with delay // Stale etag detected, retry with delay
if (resp != null && resp.etag == etag) if (resp != null && resp.etag == etag)
{ {
if (retryCount < this.maxRetries) if (retryCount < this.staleEtagMaxRetries)
{ {
retryCount++; retryCount++;
var jitter = 1 + 0.1 * (Math.random() - 0.5); var jitter = 1 + 0.1 * (Math.random() - 0.5);
var delay = retryCount * 2 * this.coolOff * jitter; var delay = retryCount * 2 * this.coolOff * jitter;
window.setTimeout(executeSave, delay); window.setTimeout(executeSave, delay);
if (urlParams['test'] == '1')
{
EditorUi.debug('DriveClient: Stale Etag Detected',
'retry', retryCount, 'delay', delay);
}
} }
else else
{ {

View file

@ -2335,6 +2335,7 @@
if (oldFile != null) if (oldFile != null)
{ {
EditorUi.debug('File.closed', [oldFile]);
oldFile.removeListener(this.descriptorChangedListener); oldFile.removeListener(this.descriptorChangedListener);
oldFile.close(); oldFile.close();
} }
@ -2461,6 +2462,8 @@
label: 'autosave_' + ((this.editor.autosave) ? 'on' : 'off')}); label: 'autosave_' + ((this.editor.autosave) ? 'on' : 'off')});
} }
EditorUi.debug('File.opened', [file]);
if (this.editor.editable && this.mode == file.getMode() && if (this.editor.editable && this.mode == file.getMode() &&
file.getMode() != App.MODE_DEVICE && file.getMode() != null) file.getMode() != App.MODE_DEVICE && file.getMode() != null)
{ {
@ -2953,6 +2956,7 @@
btn.setAttribute('title', mxResources.get('close')); btn.setAttribute('title', mxResources.get('close'));
btn.setAttribute('valign', 'absmiddle'); btn.setAttribute('valign', 'absmiddle');
btn.setAttribute('border', '0'); btn.setAttribute('border', '0');
btn.style.cursor = 'pointer';
btn.style.margin = '0 3px'; btn.style.margin = '0 3px';
var saveBtn = null; var saveBtn = null;
@ -3124,24 +3128,20 @@
// Adds drop handler from graph // Adds drop handler from graph
mxEvent.addGestureListeners(contentDiv, function(){}, mxUtils.bind(this, function(evt) mxEvent.addGestureListeners(contentDiv, function(){}, mxUtils.bind(this, function(evt)
{ {
if (graph.isMouseDown && graph.panningManager != null && graph.graphHandler.shape != null) if (graph.isMouseDown && graph.panningManager != null && graph.graphHandler.first != null)
{ {
graph.graphHandler.shape.node.style.visibility = 'hidden'; graph.graphHandler.suspend();
contentDiv.style.backgroundColor = '#f1f3f4';
contentDiv.style.cursor = 'copy';
graph.panningManager.stop();
graph.autoScroll = false;
if (graph.graphHandler.guide != null)
{
graph.graphHandler.guide.setVisible(false);
}
if (graph.graphHandler.hint != null) if (graph.graphHandler.hint != null)
{ {
graph.graphHandler.hint.style.visibility = 'hidden'; graph.graphHandler.hint.style.visibility = 'hidden';
} }
contentDiv.style.backgroundColor = '#f1f3f4';
contentDiv.style.cursor = 'copy';
graph.panningManager.stop();
graph.autoScroll = false;
mxEvent.consume(evt); mxEvent.consume(evt);
} }
}), mxUtils.bind(this, function(evt) }), mxUtils.bind(this, function(evt)
@ -3152,9 +3152,11 @@
contentDiv.style.cursor = 'default'; contentDiv.style.cursor = 'default';
this.sidebar.showTooltips = true; this.sidebar.showTooltips = true;
graph.panningManager.stop(); graph.panningManager.stop();
graph.graphHandler.reset(); graph.graphHandler.reset();
graph.isMouseDown = false; graph.isMouseDown = false;
graph.autoScroll = true; graph.autoScroll = true;
addSelection(evt); addSelection(evt);
mxEvent.consume(evt); mxEvent.consume(evt);
} }
@ -3163,22 +3165,18 @@
// Handles mouse leaving the library and restoring move // Handles mouse leaving the library and restoring move
mxEvent.addListener(contentDiv, 'mouseleave', mxUtils.bind(this, function(evt) mxEvent.addListener(contentDiv, 'mouseleave', mxUtils.bind(this, function(evt)
{ {
if (graph.isMouseDown && graph.graphHandler.shape != null) if (graph.isMouseDown && graph.graphHandler.first != null)
{ {
graph.graphHandler.shape.node.style.visibility = 'visible'; graph.graphHandler.resume();
contentDiv.style.backgroundColor = '';
contentDiv.style.cursor = '';
graph.autoScroll = true;
if (graph.graphHandler.guide != null)
{
graph.graphHandler.guide.setVisible(true);
}
if (graph.graphHandler.hint != null) if (graph.graphHandler.hint != null)
{ {
graph.graphHandler.hint.style.visibility = 'visible'; graph.graphHandler.hint.style.visibility = 'visible';
} }
contentDiv.style.backgroundColor = '';
contentDiv.style.cursor = '';
graph.autoScroll = true;
} }
})); }));
@ -6423,113 +6421,113 @@
this.convertImages(graph.getSvg(null, null, null, noCrop, null, ignoreSelection, null, null, null, addShadow), this.convertImages(graph.getSvg(null, null, null, noCrop, null, ignoreSelection, null, null, null, addShadow),
mxUtils.bind(this, function(svgRoot) mxUtils.bind(this, function(svgRoot)
{ {
var img = new Image(); try
img.onload = mxUtils.bind(this, function()
{ {
try var img = new Image();
{
var canvas = document.createElement('canvas'); img.onload = mxUtils.bind(this, function()
var w = parseInt(svgRoot.getAttribute('width')); {
var h = parseInt(svgRoot.getAttribute('height')); try
scale = (scale != null) ? scale : 1;
if (width != null)
{
scale = (!limitHeight) ? width / w : Math.min(1, Math.min((width * 3) / (h * 4), width / w));
}
w = Math.ceil(scale * w) + 2 * border;
h = Math.ceil(scale * h) + 2 * border;
canvas.setAttribute('width', w);
canvas.setAttribute('height', h);
var ctx = canvas.getContext('2d');
if (bg != null)
{ {
ctx.beginPath(); var canvas = document.createElement('canvas');
ctx.rect(0, 0, w, h); var w = parseInt(svgRoot.getAttribute('width'));
ctx.fillStyle = bg; var h = parseInt(svgRoot.getAttribute('height'));
ctx.fill(); scale = (scale != null) ? scale : 1;
}
ctx.scale(scale, scale);
function drawImage()
{
// Workaround for broken data URI images in Safari on first export
if (mxClient.IS_SF)
{
window.setTimeout(function()
{
ctx.drawImage(img, border / scale, border / scale);
callback(canvas);
}, 0);
}
else
{
ctx.drawImage(img, border / scale, border / scale);
callback(canvas);
}
};
if (grid)
{
var view = graph.view;
var gridImage = btoa(unescape(encodeURIComponent(view.createSvgGrid(view.gridColor))));
gridImage = 'data:image/svg+xml;base64,' + gridImage;
var phase = graph.gridSize * view.gridSteps * scale;
var b = graph.getGraphBounds();
var x0 = b.x * scale;
var y0 = b.y * scale;
var background = new Image(); if (width != null)
background.src = gridImage;
background.onload = function()
{ {
var x = -Math.round(phase - mxUtils.mod(view.translate.x * scale - x0, phase)); scale = (!limitHeight) ? width / w : Math.min(1, Math.min((width * 3) / (h * 4), width / w));
var y = -Math.round(phase - mxUtils.mod(view.translate.y * scale - y0, phase)); }
for (var i = x; i < w; i += phase)
{
for (var j = y; j < h; j += phase)
{
ctx.drawImage(background, i / scale, j / scale);
}
}
drawImage(); w = Math.ceil(scale * w) + 2 * border;
}; h = Math.ceil(scale * h) + 2 * border;
}
else canvas.setAttribute('width', w);
{ canvas.setAttribute('height', h);
drawImage(); var ctx = canvas.getContext('2d');
}
} if (bg != null)
catch (e) {
{ ctx.beginPath();
if (error != null) ctx.rect(0, 0, w, h);
ctx.fillStyle = bg;
ctx.fill();
}
ctx.scale(scale, scale);
function drawImage()
{
// Workaround for broken data URI images in Safari on first export
if (mxClient.IS_SF)
{
window.setTimeout(function()
{
ctx.drawImage(img, border / scale, border / scale);
callback(canvas);
}, 0);
}
else
{
ctx.drawImage(img, border / scale, border / scale);
callback(canvas);
}
};
if (grid)
{
var view = graph.view;
var gridImage = btoa(unescape(encodeURIComponent(view.createSvgGrid(view.gridColor))));
gridImage = 'data:image/svg+xml;base64,' + gridImage;
var phase = graph.gridSize * view.gridSteps * scale;
var b = graph.getGraphBounds();
var x0 = b.x * scale;
var y0 = b.y * scale;
var background = new Image();
background.src = gridImage;
background.onload = function()
{
var x = -Math.round(phase - mxUtils.mod(view.translate.x * scale - x0, phase));
var y = -Math.round(phase - mxUtils.mod(view.translate.y * scale - y0, phase));
for (var i = x; i < w; i += phase)
{
for (var j = y; j < h; j += phase)
{
ctx.drawImage(background, i / scale, j / scale);
}
}
drawImage();
};
}
else
{
drawImage();
}
}
catch (e)
{
if (error != null)
{
error(e);
}
}
});
img.onerror = function(e)
{
//console.log('img', e, img.src);
if (error != null)
{ {
error(e); error(e);
} }
} };
});
img.onerror = function(e)
{
//console.log('img', e, img.src);
if (error != null)
{
error(e);
}
};
try
{
if (addShadow) if (addShadow)
{ {
this.editor.graph.addSvgShadow(svgRoot); this.editor.graph.addSvgShadow(svgRoot);
@ -6570,27 +6568,47 @@
var done = mxUtils.bind(this, function() var done = mxUtils.bind(this, function()
{ {
if (this.editor.resolvedFontCss != null) try
{ {
addFontCss(this.editor.resolvedFontCss); if (this.editor.resolvedFontCss != null)
{
addFontCss(this.editor.resolvedFontCss);
}
if (this.editor.graph.mathEnabled)
{
this.editor.addMathCss(svgRoot);
}
img.src = this.createSvgDataUri(mxUtils.getXml(svgRoot));
} }
catch (e)
if (this.editor.graph.mathEnabled)
{ {
this.editor.addMathCss(svgRoot); if (error != null)
{
error(e);
}
} }
img.src = this.createSvgDataUri(mxUtils.getXml(svgRoot));
}); });
this.embedExtFonts(mxUtils.bind(this, function(extFontsEmbeddedCss) this.embedExtFonts(mxUtils.bind(this, function(extFontsEmbeddedCss)
{ {
if (extFontsEmbeddedCss != null) try
{ {
addFontCss(extFontsEmbeddedCss); if (extFontsEmbeddedCss != null)
{
addFontCss(extFontsEmbeddedCss);
}
this.loadFonts(done);
}
catch (e)
{
if (error != null)
{
error(e);
}
} }
this.loadFonts(done);
})); }));
} }
catch (e) catch (e)

View file

@ -810,7 +810,7 @@
} }
}, null, null, null, null, null, true, null, null, }, null, null, null, null, null, true, null, null,
'https://desk.draw.io/support/solutions/articles/16000058316', 'https://desk.draw.io/support/solutions/articles/16000058316',
[[mxResources.get('link'), function(evt, input) (EditorUi.isElectronApp) ? null : [[mxResources.get('link'), function(evt, input)
{ {
if (input.value.length > 0) if (input.value.length > 0)
{ {

View file

@ -1127,13 +1127,11 @@
mxEvent.addGestureListeners(this.moveHandle, mxUtils.bind(this, function(evt) mxEvent.addGestureListeners(this.moveHandle, mxUtils.bind(this, function(evt)
{ {
this.graph.graphHandler.start(this.state.cell, mxEvent.getClientX(evt), mxEvent.getClientY(evt)); this.graph.graphHandler.start(this.state.cell, mxEvent.getClientX(evt), mxEvent.getClientY(evt), this.graph.getSubtree(this.state.cell));
this.graph.graphHandler.cells = this.graph.getSubtree(this.state.cell);
this.graph.graphHandler.bounds = this.state.view.getBounds(this.graph.graphHandler.cells);
this.graph.graphHandler.pBounds = this.graph.graphHandler.getPreviewBounds(this.graph.graphHandler.cells);
this.graph.graphHandler.cellWasClicked = true; this.graph.graphHandler.cellWasClicked = true;
this.graph.isMouseTrigger = mxEvent.isMouseEvent(evt); this.graph.isMouseTrigger = mxEvent.isMouseEvent(evt);
this.graph.isMouseDown = true; this.graph.isMouseDown = true;
ui.hoverIcons.reset();
mxEvent.consume(evt); mxEvent.consume(evt);
})); }));
} }
@ -1154,6 +1152,18 @@
} }
}; };
var vertexHandlerSetHandlesVisible = mxVertexHandler.prototype.setHandlesVisible;
mxVertexHandler.prototype.setHandlesVisible = function(visible)
{
vertexHandlerSetHandlesVisible.apply(this, arguments);
if (this.moveHandle != null)
{
this.moveHandle.style.display = (visible) ? '' : 'none';
}
};
var vertexHandlerDestroy = mxVertexHandler.prototype.destroy; var vertexHandlerDestroy = mxVertexHandler.prototype.destroy;
mxVertexHandler.prototype.destroy = function(sender, me) mxVertexHandler.prototype.destroy = function(sender, me)

View file

@ -2105,11 +2105,27 @@ EditorUi.prototype.initCanvas = function()
} }
// Transforms graph and background image // Transforms graph and background image
mainGroup.removeAttribute('transform-origin'); mainGroup.style.transformOrigin = '';
mainGroup.removeAttribute('transform'); bgGroup.style.transformOrigin = '';
bgGroup.removeAttribute('transform-origin');
bgGroup.removeAttribute('transform'); // Workaround for no reset of transform in Safari
if (mxClient.IS_SF)
{
mainGroup.style.transform = 'scale(1)';
bgGroup.style.transform = 'scale(1)';
window.setTimeout(function()
{
mainGroup.style.transform = '';
bgGroup.style.transform = '';
}, 0)
}
else
{
mainGroup.style.transform = '';
bgGroup.style.transform = '';
}
// Shows interactive elements // Shows interactive elements
graph.view.getDecoratorPane().style.opacity = ''; graph.view.getDecoratorPane().style.opacity = '';
graph.view.getOverlayPane().style.opacity = ''; graph.view.getOverlayPane().style.opacity = '';
@ -2208,12 +2224,10 @@ EditorUi.prototype.initCanvas = function()
cursorPosition.x + graph.container.scrollLeft - graph.container.offsetLeft; cursorPosition.x + graph.container.scrollLeft - graph.container.offsetLeft;
var cy = (ignoreCursorPosition) ? graph.container.scrollTop + graph.container.clientHeight / 2 : var cy = (ignoreCursorPosition) ? graph.container.scrollTop + graph.container.clientHeight / 2 :
cursorPosition.y + graph.container.scrollTop - graph.container.offsetTop; cursorPosition.y + graph.container.scrollTop - graph.container.offsetTop;
mainGroup.setAttribute('transform-origin', cx + ' ' + cy); mainGroup.style.transformOrigin = cx + 'px ' + cy + 'px';
mainGroup.setAttribute('transform', 'scale(' + mainGroup.style.transform = 'scale(' + this.cumulativeZoomFactor + ')';
this.cumulativeZoomFactor + ')'); bgGroup.style.transformOrigin = cx + 'px ' + cy + 'px';
bgGroup.setAttribute('transform-origin', cx + ' ' + cy); bgGroup.style.transform = 'scale(' + this.cumulativeZoomFactor + ')';
bgGroup.setAttribute('transform', 'scale(' +
this.cumulativeZoomFactor + ')');
if (graph.view.backgroundPageShape != null && graph.view.backgroundPageShape.node != null) if (graph.view.backgroundPageShape != null && graph.view.backgroundPageShape.node != null)
{ {

View file

@ -1358,7 +1358,7 @@ Graph.prototype.init = function(container)
*/ */
Graph.prototype.isFastZoomEnabled = function() Graph.prototype.isFastZoomEnabled = function()
{ {
return mxClient.IS_GC && urlParams['zoom'] != 'nocss' && !this.mathEnabled && return urlParams['zoom'] != 'nocss' && !this.mathEnabled &&
!mxClient.NO_FO && !this.useCssTransforms; !mxClient.NO_FO && !this.useCssTransforms;
}; };
@ -8007,7 +8007,7 @@ if (typeof mxVertexHandler != 'undefined')
*/ */
mxGraphHandler.prototype.updateHint = function(me) mxGraphHandler.prototype.updateHint = function(me)
{ {
if (this.shape != null) if (this.pBounds != null)
{ {
if (this.hint == null) if (this.hint == null)
{ {
@ -8022,9 +8022,11 @@ if (typeof mxVertexHandler != 'undefined')
var unit = this.graph.view.unit; var unit = this.graph.view.unit;
this.hint.innerHTML = formatHintText(x, unit) + ', ' + formatHintText(y, unit); this.hint.innerHTML = formatHintText(x, unit) + ', ' + formatHintText(y, unit);
this.hint.style.left = (this.shape.bounds.x + Math.round((this.shape.bounds.width - this.hint.clientWidth) / 2)) + 'px'; this.hint.style.left = (this.pBounds.x + this.currentDx +
this.hint.style.top = (this.shape.bounds.y + this.shape.bounds.height + 12) + 'px'; Math.round((this.pBounds.width - this.hint.clientWidth) / 2)) + 'px';
this.hint.style.top = (this.pBounds.y + this.currentDy +
this.pBounds.height + 12) + 'px';
} }
}; };

View file

@ -2523,6 +2523,20 @@ Sidebar.prototype.createDragSource = function(elt, dropHandler, preview, cells,
} }
} }
// Limits drop style to non-transparent shapes
var dropStyleEnabled = true;
if (firstVertex != null && cells.length == 1)
{
var vstyle = graph.getCellStyle(cells[firstVertex]);
if (vstyle != null)
{
dropStyleEnabled = mxUtils.getValue(vstyle, mxConstants.STYLE_STROKECOLOR, mxConstants.NONE) != mxConstants.NONE ||
mxUtils.getValue(vstyle, mxConstants.STYLE_FILLCOLOR, mxConstants.NONE) != mxConstants.NONE;
}
}
var dragSource = mxUtils.makeDraggable(elt, this.editorUi.editor.graph, mxUtils.bind(this, function(graph, evt, target, x, y) var dragSource = mxUtils.makeDraggable(elt, this.editorUi.editor.graph, mxUtils.bind(this, function(graph, evt, target, x, y)
{ {
if (this.updateThread != null) if (this.updateThread != null)
@ -2841,7 +2855,7 @@ Sidebar.prototype.createDragSource = function(elt, dropHandler, preview, cells,
} }
// Shift means disabled, delayed on cells with children, shows after this.dropTargetDelay, hides after 2500ms // Shift means disabled, delayed on cells with children, shows after this.dropTargetDelay, hides after 2500ms
if (timeOnTarget < 2500 && state != null && !mxEvent.isShiftDown(evt) && if (dropStyleEnabled && (timeOnTarget < 2500) && state != null && !mxEvent.isShiftDown(evt) &&
// If shape is equal or target has no stroke, fill and gradient then use longer delay except for images // If shape is equal or target has no stroke, fill and gradient then use longer delay except for images
(((mxUtils.getValue(state.style, mxConstants.STYLE_SHAPE) != mxUtils.getValue(sourceCellStyle, mxConstants.STYLE_SHAPE) && (((mxUtils.getValue(state.style, mxConstants.STYLE_SHAPE) != mxUtils.getValue(sourceCellStyle, mxConstants.STYLE_SHAPE) &&
(mxUtils.getValue(state.style, mxConstants.STYLE_STROKECOLOR, mxConstants.NONE) != mxConstants.NONE || (mxUtils.getValue(state.style, mxConstants.STYLE_STROKECOLOR, mxConstants.NONE) != mxConstants.NONE ||

File diff suppressed because one or more lines are too long

View file

@ -17,9 +17,12 @@
color: black; color: black;
padding:6px; padding:6px;
} }
.geMenubarContainer .geItem, .geToolbar .geButton, .geToolbar .geLabel, .geSidebarContainer .geTitle { .geMenubarContainer .geItem, .geToolbar .geButton, .geToolbar .geLabel {
cursor:pointer !important; cursor:pointer !important;
} }
.geSidebarContainer .geTitle {
cursor:default !important;
}
.geBackgroundPage { .geBackgroundPage {
box-shadow:0px 0px 2px 1px #d1d1d1; box-shadow:0px 0px 2px 1px #d1d1d1;
} }