From 9db4052423f34a76296ffdcda896cdeba2b4aead Mon Sep 17 00:00:00 2001 From: Michael Lando Date: Sat, 22 Jul 2017 17:10:02 +0300 Subject: [sdc] 1710 rebase code Change-Id: Icedeac71c0a9d27518969effcd5d5519de9955a6 Signed-off-by: Michael Lando --- .../composition-ci-node-base.ts | 24 +++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) (limited to 'catalog-ui/src/app/models/graph/nodes/composition-graph-nodes/composition-ci-node-base.ts') 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; -- cgit 1.2.3-korg