Im very new to kineticjs and js, And i want to know how to use values in the attrs
I have this code
BubbleLayer.on('mouseover mousemove dragmove', function(evt) {
var node = evt.targetNode;
console.log(node)
if (node) {`enter code here`
// update tooltip
var mousePos = node.getStage().getPointerPosition();
tooltip.position({x:mousePos.x, y:mousePos.y - 5});
tooltip.getText().text("Project: " + node.id() + ", Hours: " + **need to show hours **());
tooltip.show();
tooltipLayer.batchDraw();
}
The console log shows (see image below)
I want to dispay the totalHours in the above code
tooltip.getText().text("Project: " + node.id() + ", Hours: " + **need to show hours **());
But dont know where to start. Any help would be appreciated
It's just a javascript object. You should be able to access it with node.attrs.totalHours
.