Commit 6250d3b3 authored by Igor Kulikov's avatar Igor Kulikov

take adjustCanvasSize fit value from input parameter

parent e2fbd083
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('rxjs'), require('rxjs/operators'), require('@angular/common')) :
typeof define === 'function' && define.amd ? define('ngx-flowchart', ['exports', '@angular/core', 'rxjs', 'rxjs/operators', '@angular/common'], factory) :
(global = global || self, factory(global['ngx-flowchart'] = {}, global.ng.core, global.rxjs, global.rxjs.operators, global.ng.common));
}(this, (function (exports, core, rxjs, operators, common) { 'use strict';
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('rxjs'), require('rxjs/operators'), require('@angular/cdk/coercion'), require('@angular/common')) :
typeof define === 'function' && define.amd ? define('ngx-flowchart', ['exports', '@angular/core', 'rxjs', 'rxjs/operators', '@angular/cdk/coercion', '@angular/common'], factory) :
(global = global || self, factory(global['ngx-flowchart'] = {}, global.ng.core, global.rxjs, global.rxjs.operators, global.ng.cdk.coercion, global.ng.common));
}(this, (function (exports, core, rxjs, operators, coercion, common) { 'use strict';
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
......@@ -3318,6 +3318,7 @@
this.cd = cd;
this.zone = zone;
this.modelChanged = new core.EventEmitter();
this.fitModelSizeByDefaultValue = true;
this.flowchartConstants = FlowchartConstants;
this.nodesDiffer = this.differs.find([]).create((/**
* @param {?} index
......@@ -3348,6 +3349,23 @@
enumerable: true,
configurable: true
});
Object.defineProperty(NgxFlowchartComponent.prototype, "fitModelSizeByDefault", {
get: /**
* @return {?}
*/
function () {
return this.fitModelSizeByDefaultValue;
},
set: /**
* @param {?} value
* @return {?}
*/
function (value) {
this.fitModelSizeByDefaultValue = coercion.coerceBooleanProperty(value);
},
enumerable: true,
configurable: true
});
/**
* @return {?}
*/
......@@ -3419,7 +3437,7 @@
event.preventDefault();
})
};
this.adjustCanvasSize(false);
this.adjustCanvasSize(this.fitModelSizeByDefault);
};
/**
* @return {?}
......@@ -3466,7 +3484,7 @@
}));
}
if (nodesChanged_1) {
this.adjustCanvasSize(false);
this.adjustCanvasSize(this.fitModelSizeByDefault);
}
if (nodesChanged_1 || edgesChanged_1) {
this.cd.detectChanges();
......@@ -3737,6 +3755,7 @@
nodeHeight: [{ type: core.Input }],
dropTargetId: [{ type: core.Input }],
modelChanged: [{ type: core.Output }],
fitModelSizeByDefault: [{ type: core.Input }],
dragover: [{ type: core.HostListener, args: ['dragover', ['$event'],] }],
drop: [{ type: core.HostListener, args: ['drop', ['$event'],] }],
mousedown: [{ type: core.HostListener, args: ['mousedown', ['$event'],] }],
......@@ -3766,6 +3785,11 @@
NgxFlowchartComponent.prototype.dropTargetId;
/** @type {?} */
NgxFlowchartComponent.prototype.modelChanged;
/**
* @type {?}
* @private
*/
NgxFlowchartComponent.prototype.fitModelSizeByDefaultValue;
/** @type {?} */
NgxFlowchartComponent.prototype.callbacks;
/** @type {?} */
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
import { InjectionToken, Injectable, EventEmitter, Component, ChangeDetectionStrategy, ElementRef, IterableDiffers, ChangeDetectorRef, NgZone, HostBinding, Input, Output, HostListener, Directive, Inject, ComponentFactoryResolver, ViewChild, ViewContainerRef, NgModule } from '@angular/core';
import { Subject, of } from 'rxjs';
import { debounceTime } from 'rxjs/operators';
import { coerceBooleanProperty } from '@angular/cdk/coercion';
import { CommonModule } from '@angular/common';
/**
......@@ -2627,6 +2628,7 @@ class NgxFlowchartComponent {
this.cd = cd;
this.zone = zone;
this.modelChanged = new EventEmitter();
this.fitModelSizeByDefaultValue = true;
this.flowchartConstants = FlowchartConstants;
this.nodesDiffer = this.differs.find([]).create((/**
* @param {?} index
......@@ -2653,6 +2655,19 @@ class NgxFlowchartComponent {
get canvasClass() {
return FlowchartConstants.canvasClass;
}
/**
* @return {?}
*/
get fitModelSizeByDefault() {
return this.fitModelSizeByDefaultValue;
}
/**
* @param {?} value
* @return {?}
*/
set fitModelSizeByDefault(value) {
this.fitModelSizeByDefaultValue = coerceBooleanProperty(value);
}
/**
* @return {?}
*/
......@@ -2709,7 +2724,7 @@ class NgxFlowchartComponent {
event.preventDefault();
})
};
this.adjustCanvasSize(false);
this.adjustCanvasSize(this.fitModelSizeByDefault);
}
/**
* @return {?}
......@@ -2753,7 +2768,7 @@ class NgxFlowchartComponent {
}));
}
if (nodesChanged) {
this.adjustCanvasSize(false);
this.adjustCanvasSize(this.fitModelSizeByDefault);
}
if (nodesChanged || edgesChanged) {
this.cd.detectChanges();
......@@ -2952,6 +2967,7 @@ NgxFlowchartComponent.propDecorators = {
nodeHeight: [{ type: Input }],
dropTargetId: [{ type: Input }],
modelChanged: [{ type: Output }],
fitModelSizeByDefault: [{ type: Input }],
dragover: [{ type: HostListener, args: ['dragover', ['$event'],] }],
drop: [{ type: HostListener, args: ['drop', ['$event'],] }],
mousedown: [{ type: HostListener, args: ['mousedown', ['$event'],] }],
......@@ -2979,6 +2995,11 @@ if (false) {
NgxFlowchartComponent.prototype.dropTargetId;
/** @type {?} */
NgxFlowchartComponent.prototype.modelChanged;
/**
* @type {?}
* @private
*/
NgxFlowchartComponent.prototype.fitModelSizeByDefaultValue;
/** @type {?} */
NgxFlowchartComponent.prototype.callbacks;
/** @type {?} */
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -2,6 +2,7 @@ import { __extends, __values, __assign } from 'tslib';
import { InjectionToken, Injectable, EventEmitter, Component, ChangeDetectionStrategy, ElementRef, IterableDiffers, ChangeDetectorRef, NgZone, HostBinding, Input, Output, HostListener, Directive, Inject, ComponentFactoryResolver, ViewChild, ViewContainerRef, NgModule } from '@angular/core';
import { Subject, of } from 'rxjs';
import { debounceTime } from 'rxjs/operators';
import { coerceBooleanProperty } from '@angular/cdk/coercion';
import { CommonModule } from '@angular/common';
/**
......@@ -3121,6 +3122,7 @@ var NgxFlowchartComponent = /** @class */ (function () {
this.cd = cd;
this.zone = zone;
this.modelChanged = new EventEmitter();
this.fitModelSizeByDefaultValue = true;
this.flowchartConstants = FlowchartConstants;
this.nodesDiffer = this.differs.find([]).create((/**
* @param {?} index
......@@ -3151,6 +3153,23 @@ var NgxFlowchartComponent = /** @class */ (function () {
enumerable: true,
configurable: true
});
Object.defineProperty(NgxFlowchartComponent.prototype, "fitModelSizeByDefault", {
get: /**
* @return {?}
*/
function () {
return this.fitModelSizeByDefaultValue;
},
set: /**
* @param {?} value
* @return {?}
*/
function (value) {
this.fitModelSizeByDefaultValue = coerceBooleanProperty(value);
},
enumerable: true,
configurable: true
});
/**
* @return {?}
*/
......@@ -3222,7 +3241,7 @@ var NgxFlowchartComponent = /** @class */ (function () {
event.preventDefault();
})
};
this.adjustCanvasSize(false);
this.adjustCanvasSize(this.fitModelSizeByDefault);
};
/**
* @return {?}
......@@ -3269,7 +3288,7 @@ var NgxFlowchartComponent = /** @class */ (function () {
}));
}
if (nodesChanged_1) {
this.adjustCanvasSize(false);
this.adjustCanvasSize(this.fitModelSizeByDefault);
}
if (nodesChanged_1 || edgesChanged_1) {
this.cd.detectChanges();
......@@ -3540,6 +3559,7 @@ var NgxFlowchartComponent = /** @class */ (function () {
nodeHeight: [{ type: Input }],
dropTargetId: [{ type: Input }],
modelChanged: [{ type: Output }],
fitModelSizeByDefault: [{ type: Input }],
dragover: [{ type: HostListener, args: ['dragover', ['$event'],] }],
drop: [{ type: HostListener, args: ['drop', ['$event'],] }],
mousedown: [{ type: HostListener, args: ['mousedown', ['$event'],] }],
......@@ -3569,6 +3589,11 @@ if (false) {
NgxFlowchartComponent.prototype.dropTargetId;
/** @type {?} */
NgxFlowchartComponent.prototype.modelChanged;
/**
* @type {?}
* @private
*/
NgxFlowchartComponent.prototype.fitModelSizeByDefaultValue;
/** @type {?} */
NgxFlowchartComponent.prototype.callbacks;
/** @type {?} */
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -25,6 +25,8 @@ export declare class NgxFlowchartComponent implements OnInit, DoCheck {
nodeHeight: number;
dropTargetId: string;
modelChanged: EventEmitter<any>;
private fitModelSizeByDefaultValue;
fitModelSizeByDefault: boolean;
callbacks: FcCallbacks;
userNodeCallbacks: UserNodeCallbacks;
modelService: FcModelService;
......
......@@ -19,6 +19,7 @@ import { FcEdgeDrawingService } from './edge-drawing.service';
import { FcEdgeDraggingService } from './edge-dragging.service';
import { FcMouseOverService } from './mouseover.service';
import { FcRectangleSelectService } from './rectangleselect.service';
import { coerceBooleanProperty } from '@angular/cdk/coercion';
@Component({
selector: 'fc-canvas',
......@@ -63,6 +64,15 @@ export class NgxFlowchartComponent implements OnInit, DoCheck {
@Output()
modelChanged = new EventEmitter();
private fitModelSizeByDefaultValue = true;
get fitModelSizeByDefault(): boolean {
return this.fitModelSizeByDefaultValue;
}
@Input()
set fitModelSizeByDefault(value: boolean) {
this.fitModelSizeByDefaultValue = coerceBooleanProperty(value);
}
callbacks: FcCallbacks;
userNodeCallbacks: UserNodeCallbacks;
......@@ -158,7 +168,7 @@ export class NgxFlowchartComponent implements OnInit, DoCheck {
event.preventDefault();
}
};
this.adjustCanvasSize(false);
this.adjustCanvasSize(this.fitModelSizeByDefault);
}
ngDoCheck(): void {
......@@ -184,7 +194,7 @@ export class NgxFlowchartComponent implements OnInit, DoCheck {
});
}
if (nodesChanged) {
this.adjustCanvasSize(false);
this.adjustCanvasSize(this.fitModelSizeByDefault);
}
if (nodesChanged || edgesChanged) {
this.cd.detectChanges();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment