我有一个正确显示的 chart.js 折线图。当您将鼠标悬停在 y 轴网格线上时,工具提示会按原样显示。
我正在尝试将其转换为在触摸屏上运行,因此没有悬停。有没有办法添加一个简单的参数来使工具提示在悬停和点击时显示?
请注意,我知道我可以添加自定义工具提示并添加所有功能 - 我正在尝试查看是否只有我可以添加的参数,因为我不需要自定义工具提示。
我有一个功能正常的Bootstrap 3.0手风琴,当您单击其中一个主链接时会打开.唯一的问题是,如果你点击第二个主链接,第一个链接不会崩溃 - 它们都只是保持打开状态.
有没有办法让其他部分关闭,一次只打开一个?
HTML:
<div class="container">
<!-- begin left nav -->
<div class="col-sm-2">
<div class="left-nav">
<div class="accordion" id="accordion2">
<!-- group start -->
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle leftnav-primary" data-toggle="collapse" data-parent="#accordion2" href="#collapseOne">
Main Link 1
</a>
</div>
<div id="collapseOne" class="accordion-body collapse"> <!-- add "in" to class to load acc section open -->
<div class="accordion-inner">
<div class="left-nav-section"><a href="product.html" class="leftnav-secondary">Product 1</a></div> <!-- add "selected-section" to add background color -->
<div class="left-nav-section"><a href="product.html" class="leftnav-secondary">Product 2</a></div>
<div class="left-nav-section"><a href="product.html" class="leftnav-secondary">Product 3</a></div>
<div …Run Code Online (Sandbox Code Playgroud) 我需要在使用 Google 地图绘图模式时跟踪绘制形状的坐标。我可以在绘制形状(例如多边形)后添加事件侦听器以在 和click事件中记录给定的 ID 和坐标,但它们在编辑形状(例如、、)dragend时不起作用。insert_atremove_atset_at
var shapeID = 1;
google.maps.event.addListener(drawingManager, 'polygoncomplete', function(polygon) {
drawingManager.setDrawingMode(null);
polygon.setOptions({ id: shapeID, editable:true, draggable:true });
google.maps.event.addListener(polygon, 'click', function() {
console.log(this.id+' '+this.getPath().getArray().toString());
});
google.maps.event.addListener(polygon, 'dragend', function() {
console.log(this.id+' '+this.getPath().getArray().toString());
});
google.maps.event.addListener(polygon, 'insert_at', function() {
console.log(this.id+' '+this.getPath().getArray().toString());
});
google.maps.event.addListener(polygon, 'remove_at', function() {
console.log(this.id+' '+this.getPath().getArray().toString());
});
google.maps.event.addListener(polygon, 'set_at', function() {
console.log(this.id+' '+this.getPath().getArray().toString());
});
shapeID++;
});
Run Code Online (Sandbox Code Playgroud)
设置多边形选项效果很好;如果您单击多边形,其正确的 shapeID 会记录在控制台中。
我的问题是我想添加一个这样的事件:
google.maps.event.addListener(polygon.getPath(), "insert_at", getPath);
google.maps.event.addListener(polygon.getPath(), "remove_at", getPath);
google.maps.event.addListener(polygon.getPath(), "set_at", getPath);
function getPath() …Run Code Online (Sandbox Code Playgroud) 过去我已经能够成功地使用 Ionic CLI 来构建我的 iOS 包,但是我有一系列无法摆脱的错误。存档成功了,但我仍然遇到一些问题。
1)即使我正在使用该ionic build ios命令,它也会创建一个存档包而不是构建包。
2) 我收到了一些 IDEDistribution 错误:
** ARCHIVE SUCCEEDED **
Non-system Ruby in use. This may cause packaging to fail.
If you use RVM, please run `rvm use system`.
If you use chruby, please run `chruby system`.
2017-03-15 10:00:54.132 xcodebuild[11254:474630] [MT] IDEDistribution: -[IDEDistributionLogging _createLoggingBundleAtPath:]: Created bundle at path '/var/folders/v9/dqmqkj455rjbmq4n9gg4dc4m0000gn/T/ExampleSQLite_2017-03-15_10-00-54.131.xcdistributionlogs'.
1.2.840.113635.100.1.61
Exported ExampleSQLite.xcarchive to: /Applications/XAMPP/xamppfiles/htdocs/dev/_ionic/ExampleSQLite/platforms/ios/build/device
** EXPORT SUCCEEDED **
Run Code Online (Sandbox Code Playgroud)
即使在我运行rvm use system命令后也会发生此错误。
存档设置是否在 XCode 设置中?如果我尝试ionic build android正确构建(意味着它没有存档,我会收到一条BUILD …
我需要在FabricJS画布上启用触摸缩放/平移。有一些库可以在图像上(请参阅pinch-zoom-canvas)或通过鼠标单击事件(请参阅此Fiddle)来实现此行为,但我似乎无法正确连接'touch:gesture'事件。
我已经建立了启用了手势的库(因此,这个FabricJS演示对我来说是本地工作的),但是我不知道从哪里开始将手势与工作提琴结合起来。
我试过这样的代码变体:
canvas.on({
'touch:gesture': function() {
var text = document.createTextNode(' Gesture ');
info.insertBefore(text, info.firstChild);
// Handle zoom only if 2 fingers are touching the screen
if (event.e.touches && event.e.touches.length == 2) {
// Get event point
var point = new fabric.Point(event.self.x, event.self.y);
// Remember canvas scale at gesture start
if (event.self.state == "start") {
zoomStartScale = self.canvas.getZoom();
}
// Calculate delta from start scale
var delta = zoomStartScale * event.self.scale;
// Zoom to …Run Code Online (Sandbox Code Playgroud) 我有一个按钮,删除当前视图以显示下面的内容.它工作正常,除了我想动画它.这可能吗?
有效的删除代码:
Ext.Viewport.remove(Ext.Viewport.getActiveItem(), true);
Run Code Online (Sandbox Code Playgroud)
使用动画调用另一个视图的示例:
var c = Ext.getCmp('NextView');
if(c === undefined) c = Ext.create('MyApp.view.NextView');
Ext.Viewport.animateActiveItem(Ext.getCmp('NextView'), {type: 'slide', direction: 'left'});
Run Code Online (Sandbox Code Playgroud)
我已经尝试了以下但没有成功:
Ext.Viewport.remove(Ext.Viewport.getActiveItem(), true, {type: 'slide', direction: 'left'});
Run Code Online (Sandbox Code Playgroud)
随着:
Ext.Viewport.remove(Ext.Viewport.getActiveItem(), {type: 'slide', direction: 'left'});
Run Code Online (Sandbox Code Playgroud)
注意,我需要删除屏幕(而不仅仅是调用另一个),因为该组件在整个应用程序中都是链接的.
我正在寻找一个 javascript 函数,它可以清除我地图上的所有绘图;类似于map.removeMarkers()or 的东西map.removeOverlays(),但对于形状 - 特别是圆形。
我已经看到了一些关于如何在 Android 上执行此操作的答案,但我正在寻找一个网络解决方案。我正在使用gmaps.js绘制我的圆圈:
// create circle loop
for( i = 0; i < data.mapArray.length; i++ ) {
circle = map.drawCircle({
lat: data.mapArray[i].lat,
lng: data.mapArray[i].lng,
radius: parseInt(data.mapArray[i].radius),
strokeColor: '#'+data.mapArray[i].color,
strokeWeight: 8,
fillOpacity: 0,
click: (function (e) {
return function () {
$('#'+modalType).modal({
remote: modalURL+e
});
};
})(data.mapArray[i].id)
});
} // end loop
Run Code Online (Sandbox Code Playgroud)
我猜在这个循环中我需要将圆圈添加到一个数组中,然后调用一个函数来清除所有圆圈,但我不确定如何执行。
我已经按照本教程概述了在Ionic 2应用程序中添加监控信标.我有它工作得很好:当视图加载时,它初始化并开始监听信标:
home.ts
ionViewDidLoad() {
this.platform.ready().then(() => {
this.beaconProvider.initialise().then((isInitialised) => {
if (isInitialised) {
this.listenToBeaconEvents();
}
});
});
}
Run Code Online (Sandbox Code Playgroud)
这将调用listenToBeaconEvents函数,该函数使用所有信标填充视图中的列表:
home.ts
listenToBeaconEvents() {
this.events.subscribe(‘didRangeBeaconsInRegion’, (data) => {
// update the UI with the beacon list
this.zone.run(() => {
this.beacons = [];
let beaconList = data.beacons;
beaconList.forEach((beacon) => {
let beaconObject = new BeaconModel(beacon);
this.beacons.push(beaconObject);
});
});
});
}
Run Code Online (Sandbox Code Playgroud)
我可以使用this.beaconProvider.stopRanging()以下函数调用函数来停止测距:
信标provider.ts
stopRanging() {
if (this.platform.is('cordova')) {
// stop ranging
this.ibeacon.stopRangingBeaconsInRegion(this.region)
.then(
() => {
console.log('Stopped …Run Code Online (Sandbox Code Playgroud)