This seems doable. The key is to make your graph 'editable' (i.e., config(p, editable = TRUE)) and use circle shapes, rather than geom_point() (ggplotly() will translate geom_point() to a scatter trace, which you can't drag).
Here is a simple shiny app for rendering a draggable circle shape and outputing the event tied to the "plotly_relayout" event that it triggers.
library(shiny)
library(plotly)
ui <- fluidPage(
plotlyOutput("p"),
verbatimTextOutput("event")
)
server <- function(input, output, session) {
output$p <- renderPlotly({
plot_ly() %>%
layout(
xaxis = list(range = c(-10, 10)),
yaxis = list(range = c(-10, 10)),
shapes = list(
type = "circle",
fillcolor = "gray",
line = list(color = "gray"),
x0 = -1, x1 = 1,
y0 = -1, y1 = 1,
xsizemode = "pixel",
ysizemode = "pixel",
xanchor = 0, yanchor = 0
)
) %>%
config(editable = TRUE)
})
output$event <- renderPrint({
event_data("plotly_relayout")
})
}
shinyApp(ui, server)