onmousedown

Delphi - moving overlapping TShapes

心已入冬 提交于 2019-12-17 06:51:21
问题 I've needed own triangle shape so, I inherited my triangle class form TShape and override paint method. Everything works fine, but I need to move this shapes with mouse. I set the method for every shape handling onMouseDown event. Moving work also fine. But If two shapes overlaps (shapes are in fact rectangles with some transparent areas), that the top's shape transparent area is over another shape, then the top shape moves instead of the shape below. It's correct, that is how Delphi works.

OpenLayers onmousedown load image

我是研究僧i 提交于 2019-12-13 06:44:55
问题 I was looking at this example of openLayers ( http://openlayers.org/en/v3.14.1/examples/custom-interactions.html?q=custom ) and I was wondering how can I load a small image like the one in the example on mouse down on the map? I tried several things but couldn't figure it out. Any ideas? Thanks! 回答1: The example you link to uses custom interactions to drag existing features around the map - this code is very useful and I used it to work out how to drag markers around my map. However, there is

Use onmousedown to get the ID of the element you just mousedowned on?

不打扰是莪最后的温柔 提交于 2019-12-12 08:35:09
问题 Is this possible? I am attempting to write a function for onmousedown that will return the ID of the element you just clicked for later use in recreating that element in a different div. 回答1: You can use event delegation, to basically connect only one event handler to your entire document, and get the element which the event was originally dispatched, using event.target: document.body.onmousedown = function (e) { e = e || window.event; var elementId = (e.target || e.srcElement).id; // call

Changing an image while click is held

馋奶兔 提交于 2019-12-12 04:39:01
问题 I am looking to change an image of a button from when a click is held, then change back upon click release. I currently have a flat image, and I want it to change to one with an inner-shadow to make it look like a button press, but change back to the original flat image when the mouse click is released. I tried onmouseup but I think i'm using it incorrectly. I want the "item" and "item2" to hold their image when clicked, and that works correctly. However I want the "item3" to change back upon

Javascript scroll to element with animation onclick

大城市里の小女人 提交于 2019-12-08 04:52:55
问题 I'm just starting out with JS and struggling. I got this lovely bit of code from Adam Khoury and it's working beautifully animated scrolling down the page to the target element. The ul is within a fixed position navigation bar. My question is: what code would be needed to make the animation scroll both up and down when the anchor in the nav is clicked? var scrollY = 0; var distance = 10; var speed = 24; function autoScrollTo(el) { var currentY = window.pageYOffset; var targetY = document

disable text selection and add exceptions

守給你的承諾、 提交于 2019-12-08 03:16:48
问题 if i use this style for the <body> onmousedown='return false;' onselectstart='return false;' is it possible to give the exceptions by using javascript for inputs textareas and selects? and if yes then can u show me how? 回答1: Actually, you can disable text selection without needing heavy-handed JavaScript event handlers. See my answer here: How to disable text selection highlighting using CSS? Summary: use CSS and the unselectable expando in IE. CSS: *.unselectable { -moz-user-select: -moz

D3.JS - Rotate a pie chart on mouse down event

删除回忆录丶 提交于 2019-12-04 07:09:36
问题 I am looking for an example for to rotate a pie chart on mouse down event. On mouse down, I need to rotate the pie chart either clock wise or anti clock wise direction. If there is any example how to do this in D3.js, that will help me a lot. I found an example using FusionChart and I want to achieve the same using D3.js 回答1: Pretty easy with d3: var svg = d3.select("body").append("svg") .attr("width", width) .attr("height", height) .append("g") .attr("transform", "translate(" + width / 2 + "

Use onmousedown to get the ID of the element you just mousedowned on?

南笙酒味 提交于 2019-12-04 03:33:14
Is this possible? I am attempting to write a function for onmousedown that will return the ID of the element you just clicked for later use in recreating that element in a different div. You can use event delegation , to basically connect only one event handler to your entire document, and get the element which the event was originally dispatched, using event.target : document.body.onmousedown = function (e) { e = e || window.event; var elementId = (e.target || e.srcElement).id; // call your re-create function recreate(elementId); // ... } function recreate (id) { // you can do the DOM

Simple pure Javascript drag controller slider

 ̄綄美尐妖づ 提交于 2019-12-03 07:36:55
问题 Hi Developers all over the world. I would like to have some help with a simple, pure Javascript (30 lines) , JQuery free (and other library's) drag control slider. I have been searching months and found many scripts but i don't like -Jquery cause most script need 4, 5, 6 javascript includes.. I prefer smaller and basic script.. i like to ajust them like i want and i also can lean alot from smaller scripts. All i need is a simple slider that i can use for: rescale images, scroll page, change

JavaScript How to Dynamically Move Div by Clicking and Dragging

≡放荡痞女 提交于 2019-12-02 17:32:31
Okay it would seem like it should be simple. I need to take an already existing div and move it according to mouse position within the window. I have searched everywhere and it has led me to over-complicated ways of doing the same thing and involves the use of j-query. I need to strictly use javascript for what I am trying to do. Method : var mousePosition; var div; (function createDiv(){ div = document.createElement("div"); div.style.position = "absolute"; div.style.left = "0px"; div.style.top = "0px"; div.style.width = "100px"; div.style.height = "100px"; div.style.background = "red"; div