In the appcelerator titanium application I am building, there are two widgets
an imported widget VectorImage
a custom widget staticboard, which should rely on VectorImage widget.
But I don't find the right way to import the VectorImage module in my staticboard widget controller (widget.js).
I've tried :
var VectorImage = require('com.capnajax.vectorimage/widget');
var VectorImage = require(WPATH('../../com.capnajax.vectorimage/widget'));
and also directly during my widget creation :
var image = Alloy.createController('com.capnajax.vectorimage', {
svg: WPATH('chess_pieces/'+pieceImage+'.svg'),
top: parseInt(y+inset+cellsSize*(7-rank)),
left: parseInt(x+inset+cellsSize*file),
width: cellsSize,
height: cellsSize
});
$.widget.add(image);
Please, also notice that I managed to integrate it in an hard-coded way, in my widget view (index.xml), e.g :
...
<Widget src="com.capnajax.vectorimage" svg="path.svg" />
...
So it's not the VectorImage widget to blame.
What is the correct way to use this widget in my widget.js ?
Notice that this post does not solve my problem.
try:
js:
Alloy.createWidget('com.capnajax.vectorimage' , {
svg: WPATH('chess_pieces/'+pieceImage+'.svg'),
top: parseInt(y+inset+cellsSize*(7-rank)),
left: parseInt(x+inset+cellsSize*file),
width: cellsSize,
height: cellsSize
});
Related
I need to implement card-list with scroll down button in Vuejs. What's the best way to do that? What npm packages I can use?
Put id = "content" in the parent div and on the button you call the scroll function
const containerMovie = document.getElementById("content");
containerMovie.scrollBy({
top: -600,
left: 0,
behavior: "smooth"
});
I got an instance of vue object that in code I'm adding a class:
this.$refs.myrefs[0].$el.classList.add('className');
But I would like also in code to change something inside 'className':
.className {
position: absolute;
top: 100px;
left: 100px;
}
How can I do that? I want to change 'top' and 'left' which are changing according to mouse move position on screen. any idea? How I can access to the same class and change its attributes value? the className is something that being changed.
For that actually you just need binding style
check doc
<div v-bind:style="styleObject"></div>
data: {
styleObject: {
left: 0,
top: 0
}
}
and then with mouse move you need just to get mouse position and update that object
as an example
this.styleObject.left = mouseLeft
this.styleObject.top = mouseTop
if you have many of that styles for different DOM elements, so I recommend
to use pure JS
document.getElementById("elementId").style.top = mouseTop
document.getElementById("elementId").style.left = mouseLeft
or
document.querySelector(".className").style.top = mouseTop
document.querySelector(".className").style.left = mouseLeft
I want to disable sticky toolbar which appears on top of page when page is scrolled. How it can be done ?
I resolve this problem by CSS
.ck.ck-editor__top.ck-reset_all {
z-index: var(--ck-z-modal);
position: sticky;
top: 0;
}
.ck.ck-sticky-panel__placeholder {
display : none !important;
}
.ck.ck-sticky-panel .ck-sticky-panel__content_sticky {
position: unset;
}
The fact that the toolbar appears in the wrong place when the editor is in an overflowed container is a bug that we are aware of. But in this case, I'd recommend you to not use the classic editor at all. If you want to have more control over where the toolbar goes, e.g. the DecoupledEditor (demo) allow controlling the toolbar. This editor type doesn't do anything with the toolbar itself – it just creates it and it's up to you where you're gonna insert it.
Another option would be implementing your own custom editor, but that'd be necessary only if you wanted to make even more customizations
I'm having same issue with the classic-editor, the position of the .sticky_panel is changing on the event of focus in the .editor_editable.
at some point when it's not visible within the display and click inside it goes all up to first element .
CSS only:
ck.ck-sticky-panel .ck-sticky-panel__content_sticky {
position: absolute !important;
}
In my editor build, I did a hack like this:
const stickyUpdateInterval = setInterval(() => {
editor.ui.view.stickyPanel['_checkIfShouldBeSticky']();
}, 100);
editor.on('destroy', () => {
clearInterval(stickyUpdateInterval);
});
This is just a crude hack that will update sticky balloon all the time.
If you know exactly in which overflow container your editor will be mounted, you can do something more clever, like listen to scroll events and update only then (this is what CKEditor is doing for the window, BTW, that's why it's not working when you put it in a container).
I have spent some time trying to get the CKEditor Classic component "sticky toolbar" to work nicely in Angular with a scrolling pane and there are 2 issues I had to overcome.
The position of the toolbar when sticky this defaults to the top
of the browser page (view port) - so (in Angular) you need to
configure this setting in the HTML template :
[config]="{ui:{viewportOffset:{ top: 58, right: 0, bottom: 0, left:
0}}}"
Making the editor respond to scrolling. This was a more difficult
one to resolve for me. The solution I have is (thanks to panta82
above) is to catch the scroll events and call a function in the
editor to check if the toolbar should be sticky or not .. it's
called checkIfShouldBeSticky :)
Here is a working sample in StackBlitz
I faced the same issue,
if you have header then below css will also help
#media only screen and (max-width: 767px) {
.ck-sticky-panel__content {
top: 180px !important;
}
}
#media only screen and (min-width: 768px) {
.ck-sticky-panel__content {
top: 128px !important;
}
}
document.getElementById('main')?.addEventListener('scroll', () => {
setTimeout(() => {
// eslint-disable-next-line no-underscore-dangle
editor.ui.view.stickyPanel._checkIfShouldBeSticky()
}, 100)
})
I want to create a fixed to nav bar using the vue material framework. How do I do that?
<md-whiteframe md-elevation = "3" class = "main-toolbar">
<md-toolbar class = "flex: 1">
</md-toolbar>
</md-whiteframe>
I began with this outline but I cannot seem to make it fixed no matter what I do.
You need to add sticky positioning from css. See this codepen for an example: https://codepen.io/aprouja1/pen/awKavJ
#toolbar{
position:sticky;
top:1px;
}
You can use default css like:
.main-toolbar {
position: fixed;
z-index: 1000;
left: 0;
right: 0;
}
I am using using Bingmap api, want to use static map i am using following api reference
http://msdn.microsoft.com/en-us/library/ff701724.aspx
My question is over static map can we display custom pushpin image ?
any quick idea
No - you can choose from one of the 37 built-in pushpin styles, but you can't provide your own custom icon. See http://msdn.microsoft.com/en-us/library/ff701719.aspx for reference.
No, but if you make the same request to Microsoft API with the "&mmd=1" parameter you get a JSON object which includes the pixel offsets of all the markers. With this info you could fairly easily render custom markers with CSS, or composite an image yourself with ImageMagick or similar.
Custom pushpins are not supported natively in the static map api, but as #Ed said you can get metadata about the pushpin location if you need to do this.
This will require a separate call to the same endpoint as the map image with the &mmd=1 or &mapMetadata=1 query appended in the url. This returns an object with a metadata about the map including the pushpin position (minus the map image itself)
http://msdn.microsoft.com/en-us/library/hh667439.aspx
Below is a snippet showing an example of how to do this:
// pushpinData is the returned object from the call
// the anchor property is an object like this {x:200,y:100}
var pushpinPosition = pushpinData.resourceSets[0].resources[0].pushpins[0].anchor;
// the offsets are to do minor adjustments of the image placement
var pushpinXPos = pushpinPosition.x - xoffset;
var pushPinYPos = pushpinPosition.y - $("#myMap").height()- yoffset;
var pushpin = "<img id='pushpinImg' src='marker.png'></img>";
$("#myMap").append(pushpin);
$('#pushpinImg').css('margin-left', pushpinXPos + 'px')
$('#pushpinImg').css('margin-top', pushPinYPos + 'px')
If you only need to center a single pin, which is probably the most common use case for this sort of thing, you can also generate a static image without a pin, and then use CSS to center your custom pin over the image.
Example HTML:
<div class="wrapper">
<img class="map" src="path/to/bing-maps/static/image" />
<img class="pin" src="path/to/custom/pin.jpg" />
</div>
Example CSS:
.wrapper {
max-width: 400px;
position: relative;
}
.map {
display: block;
width: 100%;
}
.pin {
display: block;
height: 34px;
left: 50%;
margin-left: -10px;
margin-top: -34px;
position: absolute;
top: 50%;
width: 20px;
}
Here's a working fiddle: http://jsfiddle.net/jaredjensen/fem4a556/