Kendoui Window set X and Y Position - kendo-ui

How do I specifically set a kendo ui window to a location x, y
Ive tried both .x and .left and .y and .right
Neither of these seem to have any effect and I cant find anything online or in the docs.

Use the position property of the window object:
http://docs.telerik.com/kendo-ui/api/javascript/ui/window#configuration-position
$("#dialog").kendoWindow({
position: {
top: 100, // or "100px"
left: "20%"
}
});

You could achieve this directly via CSS
$("#windowId").closest(".k-window").css({
top: 200,
left: 400
});

Related

how to set div max width in D3

how can I set the max width of a div within d3?
I tried
svg.append('div')
.attr('class','chart')
.attr("max-width",div_width)
.attr("height",div_height)
but it doesn't do the trick, however, if I set it in a css style with the class, it works,
div.chart {
margin : 2%;
overflow: auto;
background: rgba(51, 51, 51, 0.3);
max-width: 900px; // this works
}
I need the max width to be dynamic which is why I want to set it within d3.
Thanks for your help
I figured it out, it should be in (style) and as a string
svg.append('div')
.attr('class','chart')
.attr("max-width",div_width)
.attr("height",div_height)
should change to
svg.append('div')
.attr('class','chart')
.style("max-width",div_width+'px')
.attr("height",div_height)

How to modify the shape of a control widget in FabricJS?

I'm using FabricJS in my web application. As I draw shapes, I notice that the control widget for all the objects are rectangular. Can the shape of a control widget be modified to fit the actual shape of the object? Say, a circle with a circular control widget.
I went through the Controls Customization demo. But there is no option to modify the shape of a control widget.
I need to modify the shape of the control widgets for the following purpose:
In my application whenever an object is clicked, its fill colour is toggled between black and white. In this case(refer the image below), because the circle has a rectangular control widget, clicking the pointed pixel selects the circle instead of the rectangle. I also hide the control widget from appearing by using hasControls property. So, the user will not know anything about the control widget. So, is the shape of the control widget editable?
I don't think there is an easy way to do that with fabric.js without writing a whole bunch of extra code. Fabric.js always draws a rectangle bounding box and uses it for selection controls. However, since you're planning on hiding the controls anyway, it sounds like you might be better off using perPixelTargetFind.
When true, object detection happens on per-pixel basis rather than on
per-bounding-box
Here's a quick demo:
const canvas = new fabric.Canvas('c', {
preserveObjectStacking: true,
perPixelTargetFind: true
})
const circle = new fabric.Circle({
radius: 50,
left: 50,
top: 50,
stroke:'green',
fill: 'white',
hasControls: false,
hasBorders: false
})
const rect = new fabric.Rect({
width: 200,
height: 150,
left: 50,
top: 25,
stroke: 'green',
fill: 'black',
hasControls: false,
hasBorders: false
})
canvas.on('mouse:down', (e) => {
const obj = e.target
if (obj) {
obj.set({
fill: obj.fill === 'white' ? 'black' : 'white'
})
canvas.requestRenderAll()
}
})
canvas.add(circle, rect)
circle.bringToFront()
canvas.requestRenderAll()
body {
background: ivory;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/fabric.js/3.4.0/fabric.min.js"></script>
<canvas id="c" width="300" height="200"></canvas>

How do I create a custom control in Open Layers with an image inside?

http://openlayers.org/en/latest/examples/custom-controls.html?q=custom
This is a good example of how to create a custom control but I can't seem to make it work with an image.
The image I want to include in the custom control is here
Also, I don't want the image to do anything, just be there in a corner.
Custom controls are basically just DOM elements with event handlers, so all you need to do is create an element and apply a little CSS to it.
customControl = function(opt_options) {
var element = document.createElement('div');
element.className = 'custom-control ol-unselectable ol-control';
ol.control.Control.call(this, {
element: element
});
};
ol.inherits(customControl, ol.control.Control);
var map = new ol.Map({
layers: [new ol.layer.Tile({source: new ol.source.OSM()})],
controls: [new customControl],
target: 'map',
view: new ol.View({
center: [-11000000, 4600000],
zoom: 4
})
});
CSS:
.custom-control {
top: 20px;
right: 20px;
width: 70px;
height: 70px;
background: no-repeat url('http://openlayers.org/en/latest/examples/resources/logo-70x70.png')
}

KendoUI tooltip overflows window

I have a kendo tooltip for a field, that can contain a very long values. The default position of the tooltip is on the left of the field, however, if there's not enough space for a tooltip on the left, it automatically switches to the right. The problem i have, that sometimes, there's not enough space for a tooltip on the right either. I want to somehow control the behaviour of the tooltip in that case, and position it the way i want. Is there a way?
I had a similar situation and found the code to dynamically place a tooltip. Perhaps this will help you.
var p = $(SomeWrapper).offset();
$(element).kendoTooltip({
top: p.top,
left: p.left,
frame: false,
callout: false,
show: function (e) {
e.sender.popup.element.css('margin-top', '-10px');
e.sender.popup.element.css('margin-left', p.left + 'px');
},
width: 500,
height: 300,
position: "bottom"
});

Pleas help me float this navbar to the left

Long story short..I need my navbar to float on top of an image background (don't want to make the image into a background image). I have managed to place the navbar on the image but its in the left corner. I need it in the right corner! Please help.
http://vetamera.nu/DK/index.html
Just add right: 0; to your .top-nav class.
.top-nav {
position: absolute;
top: 5px;
right: 0;
width: 750px;
}

Resources