kineticjs

KineticJs group.setSize(300,300) not working

丶灬走出姿态 提交于 2020-01-17 03:41:09
问题 I am trying to change size of kinetic group. but it gives JavaScript error message. in kinetic js document its written than setSize works with group nodes 回答1: I think the documents are a bit outdated in that respect. Groups do not have a drawFunc so they do not have a width or height. If they ever do get width and height, it will be possible to create clipped groups, which will be nice. However, as they are now, groups are simply used to define a relative x and y starting coordinate for

KineticJs group.setSize(300,300) not working

五迷三道 提交于 2020-01-17 03:41:05
问题 I am trying to change size of kinetic group. but it gives JavaScript error message. in kinetic js document its written than setSize works with group nodes 回答1: I think the documents are a bit outdated in that respect. Groups do not have a drawFunc so they do not have a width or height. If they ever do get width and height, it will be possible to create clipped groups, which will be nice. However, as they are now, groups are simply used to define a relative x and y starting coordinate for

Drag & Drop Multiple Images from Toolbar onto Canvas

梦想的初衷 提交于 2020-01-16 04:46:29
问题 I am making an application in which user can drag & drop multiple objects from a toolbar onto a canvas.After dragging and dropping that particular object onto the canvas the user can move that object around in the canvas.Double Clicking on that object will make it disappear.I have been able to implement this for one object in the toolbar as shown in the link below.. http://jsfiddle.net/gkefk/26/ To drag & drop multiple objects from the toolbar I made the following additions in the function

Change Dragged Target in KineticJS

≯℡__Kan透↙ 提交于 2020-01-15 13:10:48
问题 Is it possible to switch the object being dragged to another object on clicking the first object? Problem: In the jsfiddle below, when the red circle is dragged, it changes into a blue rectangle but does not respond to the initial drag. A 2nd drag has to be made on the blue rectangle to drag it. Desired: It should change from red circle to blue rectangle and the blue rectangle should immediately follow the dragging motion smoothly. Attempt: I tried to .simulate() the events but it does not

Events are lost after moving layer from within a “dragmove” callback

无人久伴 提交于 2020-01-15 06:15:26
问题 I have a scrollbar that moves a layer, so the layer is moved while in the scrollbar's "dragmove" callback. This causes all bound events to be disconnected on the moved layer! Please see this fiddle: http://jsfiddle.net/NY4QK/10/ var stage = new Kinetic.Stage({ container: 'container', width: 200, height: 200, }); var fixedLayer = new Kinetic.Layer(); stage.add(fixedLayer); var old_x = 100; var old_y = 100; var scroller = new Kinetic.Circle({ x: old_x, y: old_y, radius: 10, fill: '#00F', stroke

Events are lost after moving layer from within a “dragmove” callback

情到浓时终转凉″ 提交于 2020-01-15 06:14:05
问题 I have a scrollbar that moves a layer, so the layer is moved while in the scrollbar's "dragmove" callback. This causes all bound events to be disconnected on the moved layer! Please see this fiddle: http://jsfiddle.net/NY4QK/10/ var stage = new Kinetic.Stage({ container: 'container', width: 200, height: 200, }); var fixedLayer = new Kinetic.Layer(); stage.add(fixedLayer); var old_x = 100; var old_y = 100; var scroller = new Kinetic.Circle({ x: old_x, y: old_y, radius: 10, fill: '#00F', stroke

KineticJS - Scaling stage to viewport

流过昼夜 提交于 2020-01-12 10:16:10
问题 I'm working towards a default resolution of 1366x756. I would to scale this up and down depending on the viewport. Similar to the example shown here: http://blogs.msdn.com/b/davrous/archive/2012/04/06/modernizing-your-html5-canvas-games-with-offline-apis-file-apis-css3-amp-hardware-scaling.aspx I'm kind of confused how I would get this to work in KineticJS as it abstracts away the canvas elements used. What I would like to achieve is basically: window.addEventListener("resize", OnResizeCalled

kinetics user upload an image

一个人想着一个人 提交于 2020-01-07 03:47:06
问题 I have a kineticjs box with text input and an "onLoad" image (Yoda). I need to implement this "imageLoader" (Fiddle) I have this from a canvas I put together but cant get it into my new kinetics Fiddle function loadThisImage(src) { img = new Image(); img.onload = function () { draw(img, true, false); }; img.src = src; img.view = { left: 42, top: 20, width: 160, height: 120, z: 0 }; } var ctx = canvas.getContext('2d'); function draw(img, withAnchors, withBorders) { // clear the canvas ctx

Adjusting offset on a dragged Kinetic.Path element in Kinetic JS to always keep the offset center to the Stage

若如初见. 提交于 2020-01-07 02:41:29
问题 I am having to develop a draggable and zoomable world map, and being on a closed system, cannot rely on things like Google maps. This is not going to be a full "map" application which is going to show more detail when zoomed, but basically show the world with various pins for lat/longs, and when zoomed, zoom on the area of the map that is currently centered in Stage. I have been able to create a map using the Kinetic.Path method, and also able to create a slider to set the scale factor of

Adjusting offset on a dragged Kinetic.Path element in Kinetic JS to always keep the offset center to the Stage

旧巷老猫 提交于 2020-01-07 02:41:23
问题 I am having to develop a draggable and zoomable world map, and being on a closed system, cannot rely on things like Google maps. This is not going to be a full "map" application which is going to show more detail when zoomed, but basically show the world with various pins for lat/longs, and when zoomed, zoom on the area of the map that is currently centered in Stage. I have been able to create a map using the Kinetic.Path method, and also able to create a slider to set the scale factor of