我希望用户pre通过拖动底部边框来调整我的 AngularJS 页面中元素的大小。我想要达到的效果与textarea我现在使用的 stackoverflow的方式非常相似,但只是为了pre更有效地阅读以.
这是一段简单的 AngularJS 代码
<div class="container">
<div class="jumbotron">
<div class="row">
<div class="col-md-6">
First variable
<pre>{{first}}</pre>
</div>
<div class="col-md-6">
Second variable
<pre>{{second}}</pre>
</div>
</div>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
与 pre 相关的 css 位如下
pre {
tab-size: 2;
text-align : left;
height: auto;
max-height: 240px;
overflow: auto;
word-break: normal !important;
word-wrap: normal !important;
white-space: pre !important;
};
Run Code Online (Sandbox Code Playgroud)
我想要的是能够调整任一 pre 的高度以显示更多内容。
我看了一下这个例子,认为我可以调整divs包含 pre 的大小。不幸的是我不能让它工作,但我什至不确定那是正确的方法。
在 Leaflet 上,给定中心和半径,我可以轻松创建一个新圆:
// Circle
var radius = 500; // [metres]
var circleLocation = new L.LatLng(centreLat, centreLon);
var circleOptions = {
color: 'red',
fillColor: '#f03',
fillOpacity: 0.5
};
var circle = new L.Circle(circleLocation, radius, circleOptions);
map.addLayer(circle);
Run Code Online (Sandbox Code Playgroud)
上面的圆是创建和绘制的,没有问题,就这样了。
但是,如果我现在想创建并绘制一个包围圆的矩形,则它不起作用。这是我所做的:
// Rectangle
var halfside = radius; // It was 500 metres as reported above
// convert from latlng to a point (<-- I think the problem is here!)
var centre_point = map.latLngToContainerPoint([newCentreLat, newCentreLon]);
// Compute SouthWest and NorthEast points
var sw_point = …Run Code Online (Sandbox Code Playgroud) javascript latitude-longitude leaflet angular-leaflet-directive