Skip to content

Commit e54dcec

Browse files
authored
Merge pull request #52 from zero41120/refactor/pointer-events-support
Provide pointer event option to fabric canvas
2 parents 6ebeaef + b04bcf9 commit e54dcec

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

demo.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<script src="openseadragon-fabricjs-overlay.js"></script>
88

99
<script src="//code.jquery.com/jquery-1.11.2.min.js"></script>
10-
<script src="fabric/fabric.adapted.js"></script>
10+
<script src="//cdnjs.cloudflare.com/ajax/libs/fabric.js/4.4.0/fabric.min.js"></script>
1111
<style type="text/css">
1212
html,
1313
body,

openseadragon-fabricjs-overlay.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@
5151
* @param viewer
5252
* @constructor
5353
*/
54-
let Overlay = function (viewer, staticCanvas) {
54+
let Overlay = function (viewer, staticCanvas, fabricCanvasOptions = {}) {
55+
fabricCanvasOptions.enablePointerEvents = window.PointerEvent != null;
5556
let self = this;
5657

5758
this._viewer = viewer;
@@ -76,10 +77,10 @@
7677

7778
// make the canvas static if specified, ordinary otherwise
7879
if (staticCanvas) {
79-
this._fabricCanvas = new fabric.StaticCanvas(this._canvas);
80+
this._fabricCanvas = new fabric.StaticCanvas(this._canvas, fabricCanvasOptions);
8081
}
8182
else {
82-
this._fabricCanvas = new fabric.Canvas(this._canvas);
83+
this._fabricCanvas = new fabric.Canvas(this._canvas, fabricCanvasOptions);
8384
}
8485

8586
// Disable fabric selection because default click is tracked by OSD

0 commit comments

Comments
 (0)