Code Monkey home page Code Monkey logo

Comments (5)

Fuzzyma avatar Fuzzyma commented on June 15, 2024

Are you mixing things up here? select() takes a css selector and gives you a Set. The selectize method draws a selection around the element you call it on. It is something completely different. Why would you rename something in the first place if it was working?

from svg.select.js.

AnReZa avatar AnReZa commented on June 15, 2024

@Fuzzyma After the update to 3.x, my former code doesn't work anymore. So I researched a little bit and found a note, that the select method was renamed to selectize.

Uncaught TypeError: img.select is not a function
at Object.openAnnotationEditor (diagnosis.js:804)
at Object.eval (eval at parseBindingsString (knockout.js:74), :3:148)
at HTMLDivElement. (knockout.js:100)
at HTMLDivElement.dispatch (jquery-3.3.1.min.js:2)
at HTMLDivElement.y.handle (jquery-3.3.1.min.js:2)

openAnnotationEditor: function (d, e) {
	e.stopPropagation();

	vm.data.modeData = d;
	vm.currentMode(modes.annotationEditor);

	let canvas = document.getElementById('ap-canvas');
	let canvasCoords = canvas.getBoundingClientRect();
	let img = SVG(canvas);
	let bgImg = img.select('image').first(); // That's the problematic line
	let allElements = [];
	let selectedElements = [];
	let currCtrl = null;
	let currCtrlFor = null;
	let currStream = null;
	
	// ...
}

from svg.select.js.

Fuzzyma avatar Fuzzyma commented on June 15, 2024

No, the select method of the library was never renamed. This plugin (this repo) had a nameclash with the core an thats why we renamed the method of this plugin.

In 3.0 select() returns a List which is basically a fancy array. So if you want the first element just access it with [0]

from svg.select.js.

AnReZa avatar AnReZa commented on June 15, 2024

@Fuzzyma As you can see, the error message states that select is not a function. So there must be something wrong. Have you removed .select() from the SVG object?

from svg.select.js.

Fuzzyma avatar Fuzzyma commented on June 15, 2024

my fault right there. Ofc yes. select was renamed to find(). There is also the single case equivalent findOne() which is what you are looking for. So you can just go and use ìmg.findOne('image')

from svg.select.js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.