control-freak-ide/misc/pocs/GoJS/extensionsTS/LinkLabelOnPathDragging.html
plastic-hub-dev-node-saturn 538369cff7 latest
2021-05-12 18:35:18 +02:00

34 lines
1.6 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Draggable Link Labels That Stay On Path</title>
<!-- Copyright 1998-2017 by Northwoods Software Corporation. -->
<meta charset="UTF-8">
<script src="../assets/js/goSamples.js"></script>
<!-- this is only for the GoJS Samples framework -->
</head>
<body>
<div id="sample">
<div id="myDiagramDiv" style="background-color: whitesmoke; border: solid 1px black; width: 100%; height: 600px"></div>
<p>
This sample demonstrates a custom Tool, LinkLabelOnPathDraggingTool, that allows the user to drag the label of a Link, but
that keeps the label exactly on the path of the link. The tool is defined at <a href="LinkLabelOnPathDraggingTool.ts">LinkLabelOnPathDraggingTool.ts</a>.
</p>
<p>
The label on the link can be any arbitrarily complex object. It is positioned by the <a>GraphObject.segmentIndex</a> and <a>GraphObject.segmentFraction</a> properties, which are set by the LinkLabelOnPathDraggingTool. TwoWay Bindings
on those two properties automatically remember any modified values on the link data object in the model.
</p>
<p>
The tool is derived from a similar tool, <a href="LinkLabelDraggingTool.ts">LinkLabelDraggingTool.ts</a>, that allows
the user to drag the label in any direction from the mid-point of the Link path.
</p>
</div>
<script src="../samples/assets/require.js"></script>
<script>
require(["LinkLabelOnPathDraggingScript"], function (app) {
app.init();
});
</script>
</body>
</html>