Hi
I have some problem with use yours demo sample from demos\complete\hierarchicgrouping.
I try to migrate yours code to type script and one fragment isn't work in type script.
Yours code in javascript:
/** @return {Object} */
'lookup': function(/**yfiles.graph.INode*/ node, /**yfiles.lang.Class*/ type) {
if (type === yfiles.input.INodeInsetsProvider.$class) {
return new DemoGroupStyle.MyInsetsProvider();
} else if (type === yfiles.input.INodeSizeConstraintProvider.$class) {
return new DemoGroupStyle.MySizeConstraintProvider();
}
return DemoGroupStyle.$super.lookup.call(this, node, type);
},
/** @lends {DemoGroupStyle} */
'$static': {
/**
* @class DemoGroupStyle.MyInsetsProvider
* @augments yfiles.drawing.IInsetsProvider.<yfiles.graph.INode>
*/
'MyInsetsProvider': new yfiles.lang.ClassDefinition(function() {
/** @lends {DemoGroupStyle.MyInsetsProvider.prototype} */
return {
'$with': [yfiles.input.INodeInsetsProvider],
/** @return {yfiles.geometry.Insets} */
'getInsets': function(/**yfiles.graph.INode*/ item) {
var margin = 5;
return new yfiles.geometry.Insets(
BORDER_THICKNESS + margin, HEADER_THICKNESS + margin,
BORDER_THICKNESS + margin, BORDER_THICKNESS + margin);
}
};
}),
My code in typescript:
public lookup(node: yfiles.graph.INode, type: yfiles.lang.Class): Object {
if (type === yfiles.input.INodeInsetsProvider.$class) {
return DemoGroupStyle.MyInsetsProvider();
} else if (type === yfiles.input.INodeSizeConstraintProvider.$class) {
return new MySizeConstraintProvider();
}
return super.lookup(node, type);
}
export class MyInsetsProvider implements yfiles.input.INodeInsetsProvider {
public getInsets(item: yfiles.graph.INode): yfiles.geometry.Insets {
let margin: number = 5;
return new yfiles.geometry.Insets(
BORDER_THICKNESS + margin, HEADER_THICKNESS + margin,
BORDER_THICKNESS + margin, BORDER_THICKNESS + margin);
}
}
In my code i see the metod getInsets is never use.
best regard
Wojciech Remplewicz