logo
down
shadow

Fabric getPointer method not working in Firefox


Fabric getPointer method not working in Firefox

Content Index :

Fabric getPointer method not working in Firefox
Tag : javascript , By : Cesar Sanz
Date : November 29 2020, 04:01 AM

it should still fix some issue You need to pass options.originalEvent instead of options.e in
var rectLocation = overlay.fabricCanvas().getPointer(options.originalEvent);

Comments
No Comments Right Now !

Boards Message :
You Must Login Or Sign Up to Add Your Comments .

Share : facebook icon twitter icon

toSVG method not working on extended class with Fabric.js


Tag : javascript , By : dormsbee
Date : March 29 2020, 07:55 AM
like below fixes the issue Every "class" in Fabric (rectangle, circle, image, path, etc.) knows how to output its SVG markup. The method responsible for it is toSVG. You can see toSVG of fabric.Rect, for example, or fabric.Text one.
Since you created subclass of fabric.Rect here and didn't specify toSVG, toSVG of the next object in prototype chain is used. The next "class" in the inheritance chain happens to be fabric.Rect, so you're seeing a result of fabric.Rect.prototype.toSVG.
toSVG: function() {
  var label = new fabric.Text(this.label, {
      originX: 'left',
      originY: 'top',
      left: this.left - this.width / 2,
      top: this.top - this.height / 2,
      fontSize: 20,
      fill: '#333',
      fontFamily: 'Helvetica'
  });
  return this.callSuper('toSVG') + label.toSVG();
}

DirectShow: How to get the physical address of delivery buffer return by IMediaSample::GetPointer method


Tag : windows , By : dnyaneshwar
Date : March 29 2020, 07:55 AM
Hope that helps You ask the address you anyway have by calling IMediaSample::GetPointer, so it appears that you already have what you ask for Output pin is responsible for memory allocator on the pin, so your decoder can use its own memory allocator with IMediaSample::GetPointer method in particular. You can use the buffers you allocate, and share with HW decoder implementation (also, you can have specific alignment there etc. or vice versa get the buffer from decoder for further use in DirectShow pipeline). I see it's Win CE, however anyway it does not seem very likely that excessive memcpy is visually slow, perhaps you have other bottlenecks as well.

Fabric.js Image.fromURL not working in Firefox


Tag : jquery , By : Angelo Giannatos
Date : March 29 2020, 07:55 AM
hop of those help? I figured out what was wrong. I was not passing an event to the getPointer() function.
This code now works fine:
$('#scene').droppable({
        drop: function(e, ui) {
            if ($(e.target).attr('id') === 'scene') {
                var pointer = canvas.getPointer(e);
                fabric.Image.fromURL(ui.draggable[0].currentSrc, function (img) {
                    img.filters.push(new fabric.Image.filters.Resize({scaleX: 0.2, scaleY: 0.2}));
                    img.set({
                        left: pointer.x - 20,
                        top: pointer.y - 20,
                        width: 52,
                        height: 52
                    });
                    canvas.clear();
                    canvas.add(img);
                    canvas.renderAll();
                });
            }
        }

    });

Fabric not working if not initialised in didFinishLaunchingWithOptions method


Tag : ios , By : Stephen
Date : March 29 2020, 07:55 AM
it helps some times I have contacted Fabric support, it seems their logic is completely based on app life cycle and it work properly if we initialise the Faric object other than didFinishLauch method..
So we ended up changing the logic in my app.. We are initialising Fabric for first time even if user not yet accepted in OptIn page, but not logging any custom events if he not opted-in. And then from the second launch it works as per his decision on OptIn page.

Fabric.js library Rect() method not working correctly


Tag : javascript , By : Anand
Date : March 29 2020, 07:55 AM
wish helps you You should use the built in fabric.js functions to calculate the mouse position over the canvas.
So instead of your code just use canvas.getPointer(opt.e) this will give you the exact top and left to use.
var canvas = new fabric.Canvas('c',{
 backgroundColor:'#555',selection:false
});
canvas.requestRenderAll();

var crop = {
  enable: false
};

var rectangle = new fabric.Rect({
  originX: 'left',
  originY: 'top',
  fill: 'fill',
  stroke: '#ccc',
  strokeDashArray: [2, 2],
  width: 1,
  height: 1,
  visible: false
});
canvas.add(rectangle);

canvas.on("mouse:down", function(o) {
  var point = canvas.getPointer(o.e);
  originLeft = point.x;
  originTop = point.y;
  rectangle.set({
    left: point.x,
    top: point.y,
    width:1,
    height:1
  })
  crop.enable = true;
  rectangle.visible = true;
  canvas.bringToFront(rectangle);
  canvas.requestRenderAll();
});

canvas.on("mouse:move", function(o) {
  if (crop.enable) {
    var point = canvas.getPointer(o.e);
    if (originLeft > point.x) {
      rectangle.set({
        left: Math.abs(point.x)
      });
    }
    if (originTop > point.y) {
      rectangle.set({
        top: Math.abs(point.y)
      });
    }
    rectangle.set({
      width: Math.abs(originLeft - point.x),
      height: Math.abs(originTop - point.y)
    });
    canvas.requestRenderAll();
  }
});

canvas.on("mouse:up", function(options) {
  crop.enable = false;
});
<script src="https://rawgit.com/kangax/fabric.js/master/dist/fabric.js"></script>
<canvas width="400" height="400" id="c"></canvas>
Related Posts Related QUESTIONS :
  • Why dont work change event of bootstrap input spinner?
  • How to hide overflow text content in react
  • Is there another way to write line 6
  • Cypress - how to find by text content?
  • How to setstate for the dynamic checkboxes in a loop in react?
  • Is display:none safe?
  • How to create a form to change part of a href url of a button?
  • Put many function inside function in Javascript
  • how to exit from loop after a ajax call
  • Do Angular Reactive Form Validator.min/max check Perform Type Conversions before checking the value?
  • How to Replace Text Within Script Tags Using JQuery
  • add variable to object if not undefined using short-hand
  • How can I effectively curve my items inside a list?
  • Add new record Keyboard Shortcut on Kendo Grid Mvc
  • Time and Date running on page
  • Looping through page links puppeteer doesn't return values from the newly loaded page
  • Problem with Navigator.geoLocation.getCurrentPosition not working
  • Trying to change the id of an element with Javascript
  • Embedded Schema Inserting Blank in Meteor using Collection2
  • avoid useEffect to render at first load?
  • Why is this CSS transition only working correctly on the some clicks? How to solve it?
  • Interpolated values does not reflect the latest values in an Angular app
  • Javascript classes define attribute in constructor or outside the class
  • How to block scroll event passing through to iframe until iframe is active?
  • What is the purpose of "constructor" method in javascript?
  • Stencil JS not working with non-default imports
  • Are frameworks misleadingly named for marketing purposes?
  • React <Redirect> after transition not working
  • How to send multiple parameters in a function using EJS
  • React conditional style on custom click
  • Push a block of information to an array X times based on an external variable
  • How do I populate dropdown with names, and values (numeric ids)?
  • How to apply styling to elements created with .insertAdjacentHtml method
  • Positioning key:value of an object
  • Referencing DOM Elements with React Hooks
  • TypeError: Method "getRange" of null when using multiple scripts (Libraries) in Google scripts
  • Why can't I check if an environment variable is undefined?
  • Is there a way to find what parts are the same between two strings?
  • Every change done with magicscroll and greensock get reset when I hit the bottom of the page
  • Fix a 'Cannot read property handleClick of undefined error' (and issues related to deleting an item from the DOM)
  • Answer to message if sent within a period of time
  • Enabling a button based on selected values
  • Get All possible matches between forward slashes
  • get the CSS maxWidth value of the parent javascript
  • Async function returning existing array as undefined
  • Using drop-down list to change multiple values in separate table cells
  • How to remove nested empty objects in JavaScript?
  • Convert value from text field to paragraph
  • Sorting a list based on instructions in Javascript
  • Post request doesn't work in NodeJS, OK with Request
  • How to make footer align to center in nested component scenario in React
  • fresh installed pwa does not show content
  • Working around unset "length" property on partial functions created with lodash's partialRight
  • V8 console.log does not print
  • Use child array to get count for table
  • How to create an array of objects in JavaScript?
  • How can I show date and time in the following format: "Saturday 30 April 2011, 12:05"?
  • Text is shaking on increasing font size
  • Display button when input is not empty | not working JS
  • Arrow function ES6
  • shadow
    Privacy Policy - Terms - Contact Us © scrbit.com