# Basic configuration
config <- snapline()
# Custom configuration
config <- snapline(
key = "my-snapline",
tolerance = 8,
offset = 30,
verticalLineStyle = list(
stroke = "#f00",
strokeWidth = 1.5,
lineDash = c(5, 2)
),
horizontalLineStyle = list(
stroke = "#00f",
strokeWidth = 1.5,
lineDash = c(5, 2)
)
)
# With custom filter function
config <- snapline(
filter = JS("(node) => {
// Only allow regular nodes to participate in alignment
// Exclude special nodes like 'start' or 'end'
const model = node.getModel();
return model.type !== 'start' && model.type !== 'end';
}")
)
Run the code above in your browser using DataLab