曲線上でイベントを実施したい

【ご質問】
曲線を作成し、その線上にてイベントを実施させることは可能でしょうか?

【回答】
Pathを使用することで実現可能です。
詳細は以下のサンプルをご参照ください。

{curl 6.0,7.0,8.0 applet}
{curl-file-attributes character-encoding = “shift-jis”}

{import * from CURL.GUI.SHAPES}

{define-proc package {make-path}:Path
    let path:Path =
        {Path
            {Distance2d  0mm, 40mm},
            PathOperation.curve-to,
            {Distance2d  0mm, 20mm},
            {Distance2d 20mm, 20mm},
            {Distance2d 20mm, 40mm},
            PathOperation.move-to,
            {Distance2d 20mm, 40mm},
            PathOperation.curve-to,
            {Distance2d 40mm, 40mm},
            {Distance2d 40mm, 60mm},
            {Distance2d 20mm, 60mm},
            PathOperation.move-to,
            {Distance2d 20mm, 60mm},
            PathOperation.curve-to,
            {Distance2d 20mm, 80mm},
            {Distance2d  0mm, 80mm},
            {Distance2d  0mm, 60mm}
        }
    {return path}
}

{define-class package final CurvePathShape {inherits PathShape}
  field private curve-path:Path
  field private approx-path:Path

  {constructor package {default path:Path, …}
    set self.curve-path = path
    set self.approx-path = {path.to-line-segment-path max-angle = 10deg}
    {with-compiler-directives allow-slow-spliced-arguments? = true do
        {construct-super
            self.approx-path,
            …
        }
    }
  }

  {method public {draw renderer2d:Renderer2d}:void
    {unless self.path == self.approx-path do
        set self.curve-path = self.path
        set self.approx-path = {self.path.to-line-segment-path max-angle = 10deg}
        set self.path = self.approx-path
    }
   
    let constant p-s:Distance = {self.get-local-device-pixel-size}
    let (stroke-thickness:Distance, thin-line?:bool) =
        {self.quantize-line-thickness
            self.stroke-thickness,
            quantum-size = p-s
        }
    {if thin-line? or stroke-thickness <= p-s then
        set stroke-thickness = 0m
    }

    {renderer2d.render-path
        self.curve-path,
        fill-pattern = self.color,
        stroke-thickness = stroke-thickness,
        line-style = self.line-style
    }
  }
}

{let shape:PathShape =
    {CurvePathShape
        {make-path},
        {on PointerEnter at l:PathShape do
            {set l.color = “pink”}
        },
        {on PointerLeave at l:PathShape do
            {set l.color = “black”}
        },       
        dragee = {ShapeDragee},
        shape-selectable = null,
        cursor = cursor-hand,
        stroke-thickness = 3
    }
}

{let p1:Distance2d = {Distance2d 10mm, 10mm}}
{let p2:Distance2d = {Distance2d 10mm, 20mm}}
{let p3:Distance2d = {Distance2d 100mm, 20mm}}
{let p4:Distance2d = {Distance2d 100mm, 10mm}}
{let newPath:Path = {Path p1, PathOperation.curve-to, p2, p3, p4}}

{let c:Canvas =
    {Canvas background=“white”, width=200mm, height=200mm}
}

{value
    {set shape.path = newPath}
    {c.add shape}
    c
}