Skip to content

Commit

Permalink
Merge pull request #52 from zero41120/refactor/pointer-events-support
Browse files Browse the repository at this point in the history
Provide pointer event option to fabric canvas
  • Loading branch information
altert authored Aug 1, 2021
2 parents 6ebeaef + b04bcf9 commit e54dcec
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion demo.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<script src="openseadragon-fabricjs-overlay.js"></script>

<script src="//code.jquery.com/jquery-1.11.2.min.js"></script>
<script src="fabric/fabric.adapted.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/fabric.js/4.4.0/fabric.min.js"></script>
<style type="text/css">
html,
body,
Expand Down
7 changes: 4 additions & 3 deletions openseadragon-fabricjs-overlay.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@
* @param viewer
* @constructor
*/
let Overlay = function (viewer, staticCanvas) {
let Overlay = function (viewer, staticCanvas, fabricCanvasOptions = {}) {
fabricCanvasOptions.enablePointerEvents = window.PointerEvent != null;
let self = this;

this._viewer = viewer;
Expand All @@ -76,10 +77,10 @@

// make the canvas static if specified, ordinary otherwise
if (staticCanvas) {
this._fabricCanvas = new fabric.StaticCanvas(this._canvas);
this._fabricCanvas = new fabric.StaticCanvas(this._canvas, fabricCanvasOptions);
}
else {
this._fabricCanvas = new fabric.Canvas(this._canvas);
this._fabricCanvas = new fabric.Canvas(this._canvas, fabricCanvasOptions);
}

// Disable fabric selection because default click is tracked by OSD
Expand Down

0 comments on commit e54dcec

Please sign in to comment.