Fixed Guides story
parent
02ea6f1ceb
commit
38117aefb2
|
@ -18,8 +18,7 @@ limitations under the License.
|
||||||
import {
|
import {
|
||||||
Graph,
|
Graph,
|
||||||
SelectionHandler,
|
SelectionHandler,
|
||||||
InternalEvent,
|
eventUtils,
|
||||||
constants,
|
|
||||||
EdgeHandler,
|
EdgeHandler,
|
||||||
EdgeStyle,
|
EdgeStyle,
|
||||||
RubberBandHandler,
|
RubberBandHandler,
|
||||||
|
@ -47,12 +46,9 @@ const Template = ({ label, ...args }) => {
|
||||||
container.style.background = 'url(/images/grid.gif)';
|
container.style.background = 'url(/images/grid.gif)';
|
||||||
container.style.cursor = 'default';
|
container.style.cursor = 'default';
|
||||||
|
|
||||||
// Enables guides
|
|
||||||
SelectionHandler.prototype.guidesEnabled = true;
|
|
||||||
|
|
||||||
// Alt disables guides
|
// Alt disables guides
|
||||||
SelectionHandler.prototype.useGuidesForEvent = function (me) {
|
SelectionHandler.prototype.useGuidesForEvent = function (me) {
|
||||||
return !InternalEvent.isAltDown(me.getEvent());
|
return !eventUtils.isAltDown(me.getEvent());
|
||||||
};
|
};
|
||||||
|
|
||||||
// Defines the guides to be red (default)
|
// Defines the guides to be red (default)
|
||||||
|
@ -69,6 +65,11 @@ const Template = ({ label, ...args }) => {
|
||||||
graph.setConnectable(true);
|
graph.setConnectable(true);
|
||||||
graph.gridSize = 30;
|
graph.gridSize = 30;
|
||||||
|
|
||||||
|
// Enables guides
|
||||||
|
const selectionHandler = graph.getPlugin('SelectionHandler');
|
||||||
|
if (selectionHandler)
|
||||||
|
selectionHandler.guidesEnabled = true;
|
||||||
|
|
||||||
// Changes the default style for edges "in-place" and assigns
|
// Changes the default style for edges "in-place" and assigns
|
||||||
// an alternate edge style which is applied in Graph.flip
|
// an alternate edge style which is applied in Graph.flip
|
||||||
// when the user double clicks on the adjustment control point
|
// when the user double clicks on the adjustment control point
|
||||||
|
|
Loading…
Reference in New Issue