aboutsummaryrefslogtreecommitdiffstats
path: root/catalog-ui/src/app/models/graph/nodes/composition-graph-nodes/composition-ci-node-base.ts
diff options
context:
space:
mode:
authorMichael Lando <ml636r@att.com>2017-07-22 17:10:02 +0300
committerMichael Lando <ml636r@att.com>2017-07-22 17:10:02 +0300
commit9db4052423f34a76296ffdcda896cdeba2b4aead (patch)
tree7c3b779c6d09be40283158382dee2cf02767761e /catalog-ui/src/app/models/graph/nodes/composition-graph-nodes/composition-ci-node-base.ts
parent3c3c833897dbfc0e85feaf36086a505f990ecb76 (diff)
[sdc] 1710 rebase code
Change-Id: Icedeac71c0a9d27518969effcd5d5519de9955a6 Signed-off-by: Michael Lando <ml636r@att.com>
Diffstat (limited to 'catalog-ui/src/app/models/graph/nodes/composition-graph-nodes/composition-ci-node-base.ts')
-rw-r--r--catalog-ui/src/app/models/graph/nodes/composition-graph-nodes/composition-ci-node-base.ts24
1 files changed, 19 insertions, 5 deletions
diff --git a/catalog-ui/src/app/models/graph/nodes/composition-graph-nodes/composition-ci-node-base.ts b/catalog-ui/src/app/models/graph/nodes/composition-graph-nodes/composition-ci-node-base.ts
index 1e4a735a53..681cebc8d2 100644
--- a/catalog-ui/src/app/models/graph/nodes/composition-graph-nodes/composition-ci-node-base.ts
+++ b/catalog-ui/src/app/models/graph/nodes/composition-graph-nodes/composition-ci-node-base.ts
@@ -21,7 +21,7 @@
import {ComponentInstance} from "../../../componentsInstances/componentInstance";
import {CommonCINodeBase} from "../common-ci-node-base";
import {ImageCreatorService} from "app/directives/graphs-v2/image-creator/image-creator.service";
-import {ImagesUrl} from "app/utils";
+import {ImagesUrl, GraphUIObjects} from "app/utils";
import {AngularJSBridge} from "app/services";
export interface ICompositionCiNodeBase {
@@ -51,13 +51,27 @@ export abstract class CompositionCiNodeBase extends CommonCINodeBase implements
}
- public initImage(node:Cy.Collection):string {
-
+ public initUncertifiedImage(node:Cy.Collection, nodeMinSize:number):string {
+
+ let uncertifiedIconWidth:number = GraphUIObjects.HANDLE_SIZE;
+ let nodeWidth:number = node.data('imgWidth') || node.width();
+ let uncertifiedCanvasWidth: number = nodeWidth;
+
+ if (nodeWidth < nodeMinSize) { //uncertified icon will overlap too much of the node, need to expand canvas.
+ uncertifiedCanvasWidth = nodeWidth + uncertifiedIconWidth/2; //expand canvas so that only half of the icon overlaps with the node
+ }
+
this.imageCreator.getImageBase64(this.imagesPath + ImagesUrl.RESOURCE_ICONS + this.componentInstance.icon + '.png',
- this.imagesPath + ImagesUrl.RESOURCE_ICONS + 'uncertified.png')
+ this.imagesPath + ImagesUrl.RESOURCE_ICONS + 'uncertified.png', nodeWidth, uncertifiedCanvasWidth, uncertifiedIconWidth)
.then(imageBase64 => {
this.img = imageBase64;
- node.style({'background-image': this.img});
+ node.style({
+ 'background-image': this.img,
+ 'background-width': uncertifiedCanvasWidth,
+ 'background-height': uncertifiedCanvasWidth,
+ 'width': uncertifiedCanvasWidth,
+ 'height': uncertifiedCanvasWidth
+ });
});
return this.img;