Follow js event namespacing conventions and only possibly init brush once (#2202)

* underscore the shiny_image_interaction namespace

* namespace dragstart

* use `one` instead of `on`

* compile
This commit is contained in:
Barret Schloerke
2018-09-27 16:24:53 -04:00
committed by GitHub
parent d38b939c63
commit 0704aec01b
5 changed files with 10 additions and 10 deletions

View File

@@ -120,8 +120,8 @@ $.extend(imageOutputBinding, {
// even if it's a data URL. If we try to initialize this stuff
// immediately, it can cause problems because we use we need the raw image
// height and width
$img.off("load.shiny-image-interaction");
$img.on("load.shiny-image-interaction", function() {
$img.off("load.shiny_image_interaction");
$img.one("load.shiny_image_interaction", function() {
imageutils.initCoordmap($el, opts.coordmap);
@@ -176,7 +176,7 @@ $.extend(imageOutputBinding, {
// Make image non-draggable (Chrome, Safari)
$img.css('-webkit-user-drag', 'none');
// Firefox, IE<=10
$img.on('dragstart', function() { return false; });
$img.on('dragstart.image_output', function() { return false; });
// Disable selection of image and text when dragging in IE<=10
$el.on('selectstart.image_output', function() { return false; });