void GraphEditor::handleZoomOut(void) { if (not this->isVisible()) return; auto draw = this->getCurrentGraphDraw(); if (draw->zoomScale() <= GraphDrawZoomMin) return; draw->setZoomScale(draw->zoomScale() - GraphDrawZoomStep); }
void TransformState::setLatLngZoom(const LatLng &latLng, double zoom) { double newScale = zoomScale(zoom); const double newWorldSize = newScale * util::tileSize; Bc = newWorldSize / util::DEGREES_MAX; Cc = newWorldSize / util::M2PI; const double m = 1 - 1e-15; const double f = util::clamp(std::sin(util::DEG2RAD * latLng.latitude), -m, m); ScreenCoordinate point = { -latLng.longitude * Bc, 0.5 * Cc * std::log((1 + f) / (1 - f)), }; setScalePoint(newScale, point); }
bool GiTransform::zoomByFactor(float factor, const Point2d* pxAt, bool adjust) { float scale = m_impl->viewScale; if (factor > 0) scale *= (1.f + fabsf(factor)); else scale /= (1.f + fabsf(factor)); if (adjust) { scale = mgMax(scale, m_impl->minViewScale); scale = mgMin(scale, m_impl->maxViewScale); } if (mgEquals(scale, m_impl->viewScale)) return false; return zoomScale(scale, pxAt, adjust); }
void TransformState::setLatLngZoom(const LatLng& latLng, double zoom) { LatLng constrained = latLng; if (bounds) { constrained = bounds->constrain(latLng); } double newScale = util::clamp(zoomScale(zoom), min_scale, max_scale); const double newWorldSize = newScale * util::tileSize; Bc = newWorldSize / util::DEGREES_MAX; Cc = newWorldSize / util::M2PI; const double m = 1 - 1e-15; const double f = util::clamp(std::sin(util::DEG2RAD * constrained.latitude()), -m, m); ScreenCoordinate point = { -constrained.longitude() * Bc, 0.5 * Cc * std::log((1 + f) / (1 - f)), }; setScalePoint(newScale, point); }
void WebContentAnimationItem::setZoomScale(qreal value, bool immediateCommit) { value = qBound(m_viewportMetaData->m_minimumScale, value, m_viewportMetaData->m_maximumScale); qreal curZoomScale = zoomScale(); if (qFuzzyCompare(value, curZoomScale)) { notifyZoomActions(curZoomScale); return; } if (!immediateCommit) disableContentUpdates(); m_webView->setScale(value); if (immediateCommit) commitZoom(); else m_zoomCommitTimer.start(ZoomCommitDuration); }
void TransformState::setMaxZoom(const double maxZoom) { if (maxZoom >= getMinZoom()) { max_scale = zoomScale(util::clamp(maxZoom, util::MIN_ZOOM, util::MAX_ZOOM)); } }
void WebContentAnimationItem::commitZoom() { m_zoomCommitTimer.stop(); notifyZoomActions(zoomScale()); enableContentUpdates(); }
void makePlot(struct clonePos *xList, struct clonePos *yList, struct hash *yHash) /* Write out graphics for plot. */ { struct memGfx *mg = NULL; struct tempName gifTn; char *mapName = "map"; struct clonePos *xp, *yp; int i, j, x, y, nextX, nextY; int divisions = 10; double invZoom = 1.0/zoom; double magnify = 2.0; double newZoom = zoom*magnify; double invNewZoom = 1.0/newZoom; int xCount = slCount(xList); plotName = (xCount/zoom < 50); if (xList == NULL || yList == NULL) return; font = mgSmallFont(); posSpan(xList, &xStart, &xEnd); posSpan(yList, &yStart, &yEnd); if (pix < 50 || pix > 5000) errAbort("Pixels out of range - must be between 50 an 5000"); mg = mgNew(pix, pix); mgClearPixels(mg); /* Plot dots. */ for (xp = xList; xp != NULL; xp = xp->next) { if ((yp = hashFindVal(yHash, xp->name)) != NULL) { zoomScale(xp->pos, yp->pos, &x, &y); plot(mg, x, y, xp->name, MG_BLACK); } } /* Make zooming image map. */ printf("<MAP Name=%s>\n", mapName); for (i=0; i<divisions; ++i) { double cenX = xOff + (i + 0.5) * (invZoom / divisions); double sx = cenX - invNewZoom/2; x = i*pix/divisions; nextX = (i+1)*pix/divisions; for (j=0; j<divisions; ++j) { double cenY = yOff + (j + 0.5) * (invZoom / divisions); double sy = cenY - invNewZoom/2; y = j*pix/divisions; nextY = (j+1)*pix/divisions; mapZoomIn(x, y, nextX - x, nextY - y, sx, sy, zoom*magnify); } } printf("</MAP>\n"); /* Save image in temp dir. */ makeTempName(&gifTn, "wikPic", ".gif"); mgSaveGif(mg, gifTn.forCgi, FALSE); printf( "<P><IMG SRC = \"%s\" BORDER=1 WIDTH=%d HEIGHT=%d USEMAP=#%s><BR>\n", gifTn.forHtml, pix, pix, mapName); mgFree(&mg); /* Print some extra info. */ printf("X has %d elements ranging from %d to %d<BR>\n", slCount(xList), xStart, xEnd); printf("Y has %d elements ranging from %d to %d<BR>\n", slCount(yList), yStart, yEnd); }